Pass projectile object to draw function
This commit is contained in:
+16
-16
@@ -638,7 +638,7 @@ makeShellAt pl i cid pos dir = Shell
|
||||
{ _pjPos = pos
|
||||
, _pjStartPos = pos
|
||||
, _pjVel = rotateV dir (1,0)
|
||||
, _pjPict = blank
|
||||
, _pjDraw = \_ -> blank
|
||||
, _pjID = i
|
||||
, _pjUpdate = moveShell 50 i cid 0 (rotateV dir (3,0))
|
||||
, _pjPayload = pl
|
||||
@@ -656,21 +656,21 @@ moveShell time i cid rot accel w
|
||||
then doExplode
|
||||
else w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& projectiles . ix i . pjPict .~ piclow
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> piclow)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid rot (rotateV rot accel)
|
||||
| isJust thingHit = doExplode
|
||||
| time == 35 = w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& projectiles . ix i . pjPict .~ pic
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> pic)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid spin accel
|
||||
| time >= 20 = w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& projectiles . ix i . pjPict .~ pic
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> pic)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid rot' (rotateV rot accel)
|
||||
| time > -99 = w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& randGen .~ g
|
||||
& projectiles . ix i . pjPict .~ pic
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> pic)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid rot' (rotateV rot accel)
|
||||
& projectiles . ix i . pjVel %~ (\v -> accel +.+ frict *.* v)
|
||||
& soundFromPos (ShellSound i) newPos (fromIntegral smokeTrailSound) 1 250
|
||||
@@ -678,7 +678,7 @@ moveShell time i cid rot accel w
|
||||
& smokeGen
|
||||
| time > -200 = w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& projectiles . ix i . pjPict .~ pic
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> pic)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid rot' (rotateV rot accel)
|
||||
| otherwise = doExplode
|
||||
where
|
||||
@@ -828,8 +828,8 @@ moveRemoteBomb itid time pID w
|
||||
f x | x < -369 = -10
|
||||
| otherwise = x - 1
|
||||
updatePicture =
|
||||
set (projectiles . ix pID.pjPict)
|
||||
(onLayer PtLayer $ uncurry translate newPos $ remoteBombPic time)
|
||||
set (projectiles . ix pID . pjDraw)
|
||||
(\_ -> onLayer PtLayer $ uncurry translate newPos $ remoteBombPic time)
|
||||
. lowLightDirected
|
||||
(withAlpha 0.1 red)
|
||||
newPos
|
||||
@@ -914,7 +914,7 @@ fireRemoteLauncher cr w = setLocation
|
||||
{ _pjPos = pos
|
||||
, _pjStartPos = pos
|
||||
, _pjVel = rotateV dir (1,0)
|
||||
, _pjPict = blank
|
||||
, _pjDraw = \_ -> blank
|
||||
, _pjID = i
|
||||
, _pjUpdate = moveRemoteShell 50 i cid itid dir
|
||||
}
|
||||
@@ -936,7 +936,7 @@ moveRemoteShell time i cid itid _ w
|
||||
| time > 40 = if circOnSomeWall oldPos 4 w
|
||||
then doExplosion w
|
||||
else over (projectiles . ix i . pjPos) (+.+ vel)
|
||||
$ set (projectiles . ix i . pjPict) piclow
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> piclow)
|
||||
$ set (projectiles . ix i . pjUpdate)
|
||||
(moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ setScope
|
||||
@@ -944,7 +944,7 @@ moveRemoteShell time i cid itid _ w
|
||||
| time >= 20 = case thingHit of
|
||||
Just _ -> doExplosion w
|
||||
Nothing -> over (projectiles . ix i . pjPos) (+.+ vel)
|
||||
$ set (projectiles . ix i . pjPict) pic
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> pic)
|
||||
$ set (projectiles . ix i . pjUpdate)
|
||||
(moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ setScope
|
||||
@@ -955,7 +955,7 @@ moveRemoteShell time i cid itid _ w
|
||||
w
|
||||
Nothing -> over (projectiles . ix i . pjPos) (+.+ vel)
|
||||
$ set randGen g
|
||||
$ set (projectiles . ix i . pjPict) pic
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> pic)
|
||||
$ set (projectiles . ix i . pjUpdate) (moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ over (projectiles . ix i . pjVel) (\v -> accel +.+ frict *.* v)
|
||||
$ soundFromPos (ShellSound i) newPos (fromIntegral smokeTrailSound) 1 250
|
||||
@@ -968,7 +968,7 @@ moveRemoteShell time i cid itid _ w
|
||||
$ stopSoundFrom (ShellSound i)
|
||||
w
|
||||
Nothing -> over (projectiles . ix i . pjPos) (+.+ vel)
|
||||
$ set (projectiles . ix i . pjPict) pic
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> pic)
|
||||
$ set (projectiles . ix i . pjUpdate) (moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ setScope
|
||||
w
|
||||
@@ -1014,7 +1014,7 @@ explodeRemoteRocket
|
||||
-> World
|
||||
explodeRemoteRocket itid pjid w
|
||||
= set (projectiles . ix pjid . pjUpdate) (retireRemoteRocket itid 30 pjid)
|
||||
$ set (projectiles . ix pjid . pjPict) blank
|
||||
$ set (projectiles . ix pjid . pjDraw) (\_ -> blank)
|
||||
$ set (itPoint . itUse) (const id)
|
||||
$ resetName
|
||||
$ makeExplosionAt (_pjPos (_projectiles w IM.! pjid)) w
|
||||
@@ -1034,7 +1034,7 @@ throwRemoteBomb cr w = setLocation
|
||||
{ _pjPos = p
|
||||
, _pjStartPos = p
|
||||
, _pjVel = v
|
||||
, _pjPict = blank
|
||||
, _pjDraw = \_ -> blank
|
||||
, _pjID = i
|
||||
, _pjUpdate = moveRemoteBomb itid 50 i
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ throwRemoteBomb cr w = setLocation
|
||||
explodeRemoteBomb :: Int -> Int -> Creature -> World -> World
|
||||
explodeRemoteBomb itid pjid cr w
|
||||
= set (projectiles . ix pjid . pjUpdate) (retireRemoteBomb itid 30 pjid)
|
||||
$ set (projectiles . ix pjid . pjPict) blank
|
||||
$ set (projectiles . ix pjid . pjDraw) (\_ -> blank)
|
||||
$ set (creatures . ix cid . crInv . ix j . itUse) (const id)
|
||||
$ resetName
|
||||
$ resetPict
|
||||
|
||||
Reference in New Issue
Block a user