From 34884b1b50cb1c7cdd15861690a46b0a3c748501 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sat, 14 Dec 2024 08:11:23 +0000 Subject: [PATCH] make sure gravity is applied when player walks off platform --- fcore/player.sml | 5 ++++- fcore/wall.sml | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fcore/player.sml b/fcore/player.sml index ccd45b1..0aea45d 100644 --- a/fcore/player.sml +++ b/fcore/player.sml @@ -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 diff --git a/fcore/wall.sml b/fcore/wall.sml index aaf706a..e407c8c 100644 --- a/fcore/wall.sml +++ b/fcore/wall.sml @@ -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)