Start making projectile update function rather than folded list

This commit is contained in:
2024-12-28 21:31:33 +00:00
parent e028c54948
commit 2fdc6ae557
9 changed files with 95 additions and 87 deletions
+6 -9
View File
@@ -26,10 +26,10 @@ updateProjectile pj w = foldl' (flip $ upProjectile pj) w (_pjUpdates pj)
upProjectile :: Projectile -> ProjectileUpdate -> World -> World
upProjectile pj pu = case pu of
CollisionEffectPU mdetonatorid mscreenid ->
CollisionEffectPU ->
shellCollisionCheck
mdetonatorid
mscreenid
(pj ^. pjDetonatorID)
(pj ^. pjScreenID)
pj
TimePU -> decTimMvVel pj
ThrustPU st et
@@ -79,7 +79,7 @@ applyGravityPU pj w
| otherwise = x * 0.9
newz = pj ^. pjZ + pj ^. pjZVel
--shellCollisionCheck :: (Projectile -> World -> World) -> Projectile -> World -> World
-- consider using thingHit, pushing any hit creature back
shellCollisionCheck ::
Maybe (NewInt ItmInt) ->
Maybe (NewInt ItmInt) ->
@@ -174,12 +174,9 @@ decTimMvVel :: Projectile -> World -> World
decTimMvVel pj =
cWorld . lWorld . projectiles . ix (_pjID pj)
%~ ( (pjTimer -~ 1)
. (pjPos %~ (+.+ vel))
. (pjDir +~ rot)
. (pjPos +~ _pjVel pj)
. (pjDir +~ _pjSpin pj)
)
where
rot = _pjSpin pj
vel = _pjVel pj
explodeShell ::
Maybe (NewInt ItmInt) ->