Refactor creature draw, pass World to function
This commit is contained in:
@@ -33,7 +33,7 @@ launcher = defaultGun
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 20
|
||||
, _itUseTime = 0
|
||||
, _itUse = \_ -> shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeExplosionAt
|
||||
, _itUse = \it -> shootWithSound (fromIntegral launcherSound) $ aRocketWithItemParams it
|
||||
, _wpSpread = 0.02
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
@@ -48,30 +48,20 @@ launcher = defaultGun
|
||||
}
|
||||
}
|
||||
flameLauncher :: Item
|
||||
flameLauncher = launcher
|
||||
{ _itName = "FLROCKO"
|
||||
, _itUse = \_ -> shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeFlameExplosionAt
|
||||
}
|
||||
|
||||
flameLauncher = launcher & wpAmmo . amPayload .~ makeFlameExplosionAt
|
||||
poisonLauncher :: Item
|
||||
poisonLauncher = launcher
|
||||
{ _itName = "POISROCK"
|
||||
, _itUse = \_ -> shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makePoisonExplosionAt
|
||||
}
|
||||
|
||||
poisonLauncher = launcher & wpAmmo . amPayload .~ makePoisonExplosionAt
|
||||
teslaLauncher :: Item
|
||||
teslaLauncher = launcher
|
||||
{ _itName = "TESLROCK"
|
||||
, _itUse = \_ -> shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeTeslaExplosionAt
|
||||
}
|
||||
teslaLauncher = launcher & wpAmmo . amPayload .~ makeTeslaExplosionAt
|
||||
|
||||
aRocketWithPayload
|
||||
:: (Point2 -> World -> World) -- ^ Payload
|
||||
aRocketWithItemParams
|
||||
:: Item -- ^ Firing item
|
||||
-> Creature
|
||||
-> World
|
||||
-> World
|
||||
aRocketWithPayload pl cr w = over projectiles (IM.insert i theShell) w
|
||||
aRocketWithItemParams it cr w = over projectiles (IM.insert i theShell) w
|
||||
where
|
||||
pl = _amPayload $ _wpAmmo it
|
||||
cid = _crID cr
|
||||
i = IM.newKey $ _projectiles w
|
||||
pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
|
||||
|
||||
Reference in New Issue
Block a user