Pass projectile object to draw function
This commit is contained in:
@@ -32,8 +32,8 @@ moveGrenade time dir pID w = case hitWl of
|
||||
_ -> updatedWorld
|
||||
where
|
||||
updatedWorld = updateV $ set (projectiles . ix pID . pjPos) finalPos
|
||||
$ set (projectiles .ix pID.pjPict)
|
||||
(onLayer PtLayer $ uncurry translate newPos
|
||||
$ set (projectiles .ix pID. pjDraw)
|
||||
(\ _ -> onLayer PtLayer $ uncurry translate newPos
|
||||
$ rotate dir $ grenadePic time)
|
||||
$ set (projectiles .ix pID.pjUpdate) (moveGrenade (time-1) dir pID) w
|
||||
pj = _projectiles w IM.! pID
|
||||
@@ -67,7 +67,7 @@ throwGrenade explosion cr w = setWp $ removePict $ over projectiles addG w
|
||||
{ _pjPos = p
|
||||
, _pjStartPos = p
|
||||
, _pjVel = v
|
||||
, _pjPict = onLayer PtLayer $ uncurry translate p $ grenadePic 0
|
||||
, _pjDraw = \_ -> onLayer PtLayer $ uncurry translate p $ grenadePic 0
|
||||
, _pjID = i
|
||||
, _pjUpdate = moveGrenade fuseTime dir i
|
||||
, _pjPayload = explosion
|
||||
|
||||
@@ -126,7 +126,7 @@ tractorBeamAt colID i pos dir = Projectile
|
||||
{ _pjPos = pos
|
||||
, _pjStartPos = p'
|
||||
, _pjVel = d
|
||||
, _pjPict = blank
|
||||
, _pjDraw = \_ -> blank
|
||||
, _pjID = i
|
||||
, _pjUpdate = updateTractor colID 10 i
|
||||
}
|
||||
@@ -139,7 +139,7 @@ The interaction of this with objects, walls etc needs more thought. -}
|
||||
updateTractor :: Int -> Int -> Int -> World -> World
|
||||
updateTractor colID time i w
|
||||
| time > 0 = set (projectiles . ix i . pjUpdate) (updateTractor colID (time-1) i)
|
||||
$ set (projectiles . ix i . pjPict) pic
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> pic)
|
||||
$ over creatures (IM.map tractCr)
|
||||
$ over floorItems (IM.map tractFlIt)
|
||||
w
|
||||
|
||||
Reference in New Issue
Block a user