From 8996810b1356c2224d4f34423fd4211de20da238 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 19 Feb 2019 16:22:39 -0500 Subject: 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. --- src/main.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') 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**) Entity& crate = sim.getEntity(crateId); crate.size = TILE_SIZE; crate.speed = 4.0; - crate.playerCanPush = true; + crate.colliderType = ColliderType::crate; + crate.canBePushedBy.insert(ColliderType::player); + crate.canBePushedBy.insert(ColliderType::crate); sim.setGridPos(crateId, vec2s { 4, 5 } ); + Simulation::id_type crateId2 = sim.emplaceEntity(); + Entity& crate2 = sim.getEntity(crateId2); + crate2.size = TILE_SIZE; + crate2.speed = 4.0; + crate2.colliderType = ColliderType::crate; + crate2.canBePushedBy.insert(ColliderType::player); + crate2.canBePushedBy.insert(ColliderType::crate); + sim.setGridPos(crateId2, vec2s { 6, 7 } ); + bool quit = false; SDL_Event e; -- cgit 1.4.1