Refactor inverse shockwave

This commit is contained in:
2021-09-26 12:09:44 +01:00
parent a823d4c6df
commit 79b2692199
15 changed files with 87 additions and 94 deletions
+6 -6
View File
@@ -28,7 +28,7 @@ aRadarPulse cr = over particles (radarPulseAt (_crPos cr) :)
blipAt :: Point2 -> Color -> Int -> Particle
blipAt p col i = Particle
{_ptDraw = const blank
,_ptUpdate' = mvBlip p col i i
,_ptUpdate = mvBlip p col i i
}
mvBlip :: Point2 -> Color
-> Int -- ^ Max possible timer value
@@ -37,7 +37,7 @@ mvBlip :: Point2 -> Color
mvBlip _ _ _ 0 w _ = (w, Nothing)
mvBlip p col maxt t w pt =
(w
, Just $ pt & ptUpdate' .~ mvBlip p col maxt (t-1)
, Just $ pt & ptUpdate .~ mvBlip p col maxt (t-1)
& ptDraw .~ ( const
. setDepth (-0.5)
. setLayer 1
@@ -47,7 +47,7 @@ mvBlip p col maxt t w pt =
)
{- | An outwardly increasing circle that draws creatures, even those behind walls. -}
sonarPulseAt :: Point2 -> Particle
sonarPulseAt p = Particle { _ptDraw = const blank , _ptUpdate' = mvSonar 100 p }
sonarPulseAt p = Particle { _ptDraw = const blank , _ptUpdate = mvSonar 100 p }
mvSonar
:: Int -- ^ Timer
@@ -55,7 +55,7 @@ mvSonar
-> World -> Particle -> (World, Maybe Particle)
mvSonar 0 _ w _ = (w, Nothing)
mvSonar x p w pt = (w, Just $ pt {_ptDraw = const pic
,_ptUpdate' = mvSonar (x-1) p
,_ptUpdate = mvSonar (x-1) p
}
)
where
@@ -77,7 +77,7 @@ An outwardly increasing circle that displays walls, even those behind other wall
radarPulseAt :: Point2 -> Particle
radarPulseAt p = Particle
{ _ptDraw = const blank
, _ptUpdate' = mvRadar 50 p
, _ptUpdate = mvRadar 50 p
}
mvRadar
:: Int -- ^ Timer
@@ -86,7 +86,7 @@ mvRadar
mvRadar 0 _ w _ = (w, Nothing)
mvRadar x p w pt =
( putBlips w
, Just $ pt {_ptDraw = const pic ,_ptUpdate' = mvRadar (x-1) p }
, Just $ pt {_ptDraw = const pic ,_ptUpdate = mvRadar (x-1) p }
)
where
pic = onLayerL [levLayer ShadowLayer, 1] $ pictures sweepPics