Rename (indexed) particles to projectiles

This commit is contained in:
jgk
2021-03-23 14:03:00 +01:00
parent 941fef134d
commit 885fa4a67e
11 changed files with 245 additions and 251 deletions
+8 -8
View File
@@ -14,8 +14,8 @@ import qualified Data.IntMap.Strict as IM
drawCircleAtFor :: Point2 -> Int -> World -> World
drawCircleAtFor p t w =
let n = newParticleKey w
in over particles ( IM.insert n
Particle { _ptPos = p
in over projectiles ( IM.insert n
Projectile { _ptPos = p
, _ptStartPos = p
, _ptVel = (0,0)
, _ptPict = onLayer PtLayer $ uncurry translate p $ color white $ circleSolid 20
@@ -25,8 +25,8 @@ drawCircleAtFor p t w =
drawCircleAtForCol :: Point2 -> Int -> Color -> World -> World
drawCircleAtForCol p t col w =
let n = newParticleKey w
in over particles ( IM.insert n
Particle { _ptPos = p
in over projectiles ( IM.insert n
Projectile { _ptPos = p
, _ptStartPos = p
, _ptVel = (0,0)
, _ptPict = onLayer PtLayer $ uncurry translate p $ color col $ circleSolid 20
@@ -36,8 +36,8 @@ drawCircleAtForCol p t col w =
drawLineForCol :: [Point2] -> Int -> Color -> World -> World
drawLineForCol ps t col w =
let n = newParticleKey w
in over particles ( IM.insert n
Particle { _ptPos = head ps
in over projectiles ( IM.insert n
Projectile { _ptPos = head ps
, _ptStartPos = head ps
, _ptVel = (0,0)
, _ptPict = onLayer PtLayer $ color col $ lineOfThickness 5 ps
@@ -46,5 +46,5 @@ drawLineForCol ps t col w =
} ) w
ptTimer :: Int -> Int -> World -> World
ptTimer 0 i = over particles (IM.delete i)
ptTimer time i = set (particles . ix i . ptUpdate) $ ptTimer (time - 1) i
ptTimer 0 i = over projectiles (IM.delete i)
ptTimer time i = set (projectiles . ix i . ptUpdate) $ ptTimer (time - 1) i