From 7a1d4eb4481fa54753673e67532039da2b9c0b2f Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Wed, 19 Apr 2023 22:10:21 +0100 Subject: Simplified frame update When the entity hits the player we don't really need to update the frame. --- src/Game/Entities/Robot.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/Game/Entities/Robot.hs') diff --git a/src/Game/Entities/Robot.hs b/src/Game/Entities/Robot.hs index 11a10c5..5cc9d70 100644 --- a/src/Game/Entities/Robot.hs +++ b/src/Game/Entities/Robot.hs @@ -30,8 +30,7 @@ mkRobot sprites x y d playerCollision isBlocked = do updateRobot :: Collision -> IsBlocked -> Entity -> IO Entity updateRobot touchedPlayer isBlocked e = do touched <- touchedPlayer e - let updated = updateFrame True e - pure $ if touched then updated {actions = [ActionHitPlayer]} else updateMovement updated + pure $ if touched then e {actions = [ActionHitPlayer]} else updateMovement $ updateFrame True e where updateMovement :: Entity -> Entity updateMovement ent -- cgit v1.2.3