Refactor
This commit is contained in:
@@ -90,18 +90,17 @@ mvRadar
|
||||
-> Point2 -- ^ Center of expanding circle
|
||||
-> World -> Particle -> (World, Maybe Particle)
|
||||
mvRadar 0 _ w _ = (w, Nothing)
|
||||
mvRadar x p w pt = (putBlips w, Just $ pt {_ptDraw = const pic
|
||||
,_ptUpdate' = mvRadar (x-1) p
|
||||
}
|
||||
)
|
||||
mvRadar x p w pt =
|
||||
( putBlips w
|
||||
, Just $ pt {_ptDraw = const pic ,_ptUpdate' = mvRadar (x-1) p }
|
||||
)
|
||||
where
|
||||
pic = onLayerL [levLayer ShadowLayer, 1] $ pictures $ sweepPics
|
||||
putBlips = over worldEvents ((.) $ over particles ((++) blips))
|
||||
blips = map (\p -> blipAt p (withAlpha (0.5*globalAlpha) red) 50)
|
||||
$ circPoints
|
||||
circPoints = mapMaybe (\wl -> collidePointCircCorrect (fst $ _wlLine wl) (snd $ _wlLine wl) r p)
|
||||
$ (map (over wlLine swp) $ IM.elems $ wallsAlongCirc p r w)
|
||||
++ (IM.elems $ wallsAlongCirc p r w)
|
||||
pic = onLayerL [levLayer ShadowLayer, 1] $ pictures sweepPics
|
||||
putBlips = over worldEvents ( ( over particles (blips ++) ) . )
|
||||
blips = map (\p -> blipAt p (withAlpha (0.5*globalAlpha) red) 50) circPoints
|
||||
circPoints = mapMaybe (\wl -> uncurry collidePointCircCorrect (_wlLine wl) r p)
|
||||
$ map (over wlLine swp) (IM.elems $ wallsAlongCirc p r w)
|
||||
++ IM.elems (wallsAlongCirc p r w)
|
||||
swp (a,b) = (b,a)
|
||||
r = fromIntegral (800 - x*16)
|
||||
sweepPics = [--colHelper 0.1 $ uncurry translate p $ thickCircle r 15
|
||||
@@ -117,14 +116,14 @@ aTractorBeam
|
||||
-> Int -- ^ Creature id
|
||||
-> World
|
||||
-> World
|
||||
aTractorBeam col cid w
|
||||
= set (creatures . ix cid . crInv . ix itRef . wpFire)
|
||||
(shoot $ aTractorBeam ((col + 1) `mod` 10))
|
||||
$ over projectiles (IM.insert i (tractorBeamAt col i pos dir)) w
|
||||
aTractorBeam col cid w
|
||||
= set (creatures . ix cid . crInv . ix itRef . wpFire)
|
||||
(shoot $ aTractorBeam ((col + 1) `mod` 10))
|
||||
$ over projectiles (IM.insert i (tractorBeamAt col i pos dir)) w
|
||||
where
|
||||
i = newProjectileKey w
|
||||
cr = (_creatures w IM.! cid)
|
||||
pos = _crPos cr +.+ ((_crRad cr +10) *.* unitVectorAtAngle dir)
|
||||
cr = _creatures w IM.! cid
|
||||
pos = _crPos cr +.+ ((_crRad cr + 10) *.* unitVectorAtAngle dir)
|
||||
dir = _crDir cr
|
||||
itRef = _crInvSel cr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user