make sure gravity is applied when player walks off platform

This commit is contained in:
2024-12-14 08:11:23 +00:00
parent 1901043535
commit 34884b1b50
2 changed files with 6 additions and 2 deletions

View File

@@ -69,7 +69,10 @@ struct
val collisions = QuadTree.getCollisionSides
(desiredX, y, size, size, 0, 0, 1920, 1080, 0, Wall.tree)
in
checkWalls (yAxis, xAxis, desiredX, y, health, collisions)
(* using default yAxis of FALLING when on ground
* ensures that gravity is applied
* when player walks off from platform *)
checkWalls (FALLING, xAxis, desiredX, y, health, collisions)
end
| FALLING =>
let

View File

@@ -5,8 +5,9 @@ struct
val wall1 = {id = 1, x = 0, y = 0, width = 100, height = 1080}
val wall2 = {id = 2, x = 1820, y = 0, width = 100, height = 1080}
val wall3 = {id = 3, x = 0, y = 980, width = 1920, height = 108}
val wall4 = {id = 4, x = 155, y = 911, width = 155, height = 55}
val wallVec = Vector.fromList [wall1, wall2, wall3]
val wallVec = Vector.fromList [wall1, wall2, wall3, wall4]
fun getID n =
Vector.sub (wallVec, n - 1)