From 6696389ca47cf2fab8e907a072c6f71eb77ce2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 15 Sep 2018 11:19:28 +0200 Subject: [PATCH] Allow walking through doors --- demo2.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/demo2.cpp b/demo2.cpp index b4053d5..8f15cf9 100644 --- a/demo2.cpp +++ b/demo2.cpp @@ -774,6 +774,12 @@ Unit floorHeightAt(int16_t x, int16_t y) return UNITS_PER_SQUARE * 2; } +Unit collisionAt(int16_t x, int16_t y) +{ + Unit square = level[(LEVEL_Y_RES - y -1) * LEVEL_X_RES + x]; + return square == 0 || square == 6 ? 0 : UNITS_PER_SQUARE; +} + Unit textureAt(int16_t x, int16_t y) { Unit t = 0; @@ -963,7 +969,7 @@ int main() } player.update(moveDirection,strafe,rotationDirection,false,0, - floorHeightAt,0,false,dt); + collisionAt,0,false,dt); } }