summary refs log tree commit diff stats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2019-02-19 16:22:39 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2019-02-19 16:22:39 -0500
commit8996810b1356c2224d4f34423fd4211de20da238 (patch)
tree9beab3f77e6af1c769e14cff4234ad649cf857f2 /src/main.cpp
parent7514077a07076403f29050e57fa87f24fc614122 (diff)
downloaddispatcher-8996810b1356c2224d4f34423fd4211de20da238.tar.gz
dispatcher-8996810b1356c2224d4f34423fd4211de20da238.tar.bz2
dispatcher-8996810b1356c2224d4f34423fd4211de20da238.zip
Restrictions for moving into a space a block is moving out of
An entity can only move into a space a block is moving out of if the time it would take the entity to move into the tile is at least the time remaining for the other block to finish moving out of the space.

Also, crates can push each other now.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index c041cf8..c77d25b 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -26,9 +26,20 @@ int main(int, char**)
26 Entity& crate = sim.getEntity(crateId); 26 Entity& crate = sim.getEntity(crateId);
27 crate.size = TILE_SIZE; 27 crate.size = TILE_SIZE;
28 crate.speed = 4.0; 28 crate.speed = 4.0;
29 crate.playerCanPush = true; 29 crate.colliderType = ColliderType::crate;
30 crate.canBePushedBy.insert(ColliderType::player);
31 crate.canBePushedBy.insert(ColliderType::crate);
30 sim.setGridPos(crateId, vec2s { 4, 5 } ); 32 sim.setGridPos(crateId, vec2s { 4, 5 } );
31 33
34 Simulation::id_type crateId2 = sim.emplaceEntity();
35 Entity& crate2 = sim.getEntity(crateId2);
36 crate2.size = TILE_SIZE;
37 crate2.speed = 4.0;
38 crate2.colliderType = ColliderType::crate;
39 crate2.canBePushedBy.insert(ColliderType::player);
40 crate2.canBePushedBy.insert(ColliderType::crate);
41 sim.setGridPos(crateId2, vec2s { 6, 7 } );
42
32 bool quit = false; 43 bool quit = false;
33 44
34 SDL_Event e; 45 SDL_Event e;