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); } }