From 1b05eefc7a5a4fb688d7b631529324ca08ed1a16 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Wed, 1 Mar 2023 23:11:31 +0000 Subject: Untangle state changes into actions WIP: still unclear if we really need the IORefs! --- src/Game/Entities/Player.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Game/Entities/Player.hs') diff --git a/src/Game/Entities/Player.hs b/src/Game/Entities/Player.hs index f0a526c..87e8a7a 100644 --- a/src/Game/Entities/Player.hs +++ b/src/Game/Entities/Player.hs @@ -23,7 +23,7 @@ mkPlayer sprites x y controls isBlocked = do sprite = s, update = updatePlayer controls isBlocked, destroy = False, - spawns = [] + actions = [] } updateHorizontal :: IsBlocked -> Bool -> Bool -> Entity -> Entity @@ -48,7 +48,7 @@ updateVertical isBlocked jump down e -- make jumping easier with "Coyote time" || (e.gravity /= gravityOff && (e.gravity < gravityDown || e.gravity > jumpLimit)) = e - | not down = e {jumping = True, gravity = gravityUp, frame = jumpFrame, spawns = e.spawns ++ [DustEffectSpawn e.x (e.y + 8)]} + | not down = e {jumping = True, gravity = gravityUp, frame = jumpFrame, actions = [ActionAddDustEffect e.x (e.y + 8)]} -- go down a 8 pixel tall platform; not ideal to have these values hardcoded here -- but to be fair, the player height/width is hardcoded as well | down -- cgit v1.2.3