Add basic booster
This commit is contained in:
@@ -16,21 +16,13 @@ import Geometry
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
{- |
|
||||
Creates an outwardly increasing circle that draws creatures, even those behind walls. -}
|
||||
{- | Creates an outwardly increasing circle that draws creatures, even those behind walls. -}
|
||||
aSonarPulse :: Creature -> World -> World
|
||||
aSonarPulse cr w = over particles ((:) $ sonarPulseAt (_crPos cr)) w
|
||||
|
||||
{- |
|
||||
Creates an outwardly increasing circle that displays walls, even those behind other walls. -}
|
||||
aSonarPulse cr = over particles (sonarPulseAt (_crPos cr) :)
|
||||
{- | Creates an outwardly increasing circle that displays walls, even those behind other walls. -}
|
||||
aRadarPulse :: Creature -> World -> World
|
||||
aRadarPulse cr w = over particles ((:) $ radarPulseAt (_crPos (_creatures w IM.! cid))) w
|
||||
where
|
||||
cid = _crID cr
|
||||
|
||||
{- |
|
||||
Radar blip at a point.
|
||||
-}
|
||||
aRadarPulse cr = over particles (radarPulseAt (_crPos cr) :)
|
||||
{- | Radar blip at a point. -}
|
||||
blipAt :: Point2 -> Color -> Int -> Particle
|
||||
blipAt p col i = Particle
|
||||
{_ptDraw = const blank
|
||||
@@ -42,17 +34,17 @@ mvBlip :: Point2 -> Color
|
||||
-> Int -- ^ Current timer value
|
||||
-> World -> Particle -> (World, Maybe Particle)
|
||||
mvBlip _ _ _ 0 w _ = (w, Nothing)
|
||||
mvBlip p col maxt t w pt
|
||||
= (w, Just $ pt & ptUpdate' .~ mvBlip p col maxt (t-1)
|
||||
& ptDraw .~ (const . setDepth (-0.5)
|
||||
. setLayer 1
|
||||
$ uncurry translate p
|
||||
$ color (withAlpha (fromIntegral t / fromIntegral maxt) col)
|
||||
$ circleSolid 2)
|
||||
)
|
||||
|
||||
{- |
|
||||
An outwardly increasing circle that draws creatures, even those behind walls. -}
|
||||
mvBlip p col maxt t w pt =
|
||||
(w
|
||||
, Just $ pt & ptUpdate' .~ mvBlip p col maxt (t-1)
|
||||
& ptDraw .~ ( const
|
||||
. setDepth (-0.5)
|
||||
. setLayer 1
|
||||
. uncurry translate p
|
||||
. color (withAlpha (fromIntegral t / fromIntegral maxt) col)
|
||||
$ circleSolid 2 )
|
||||
)
|
||||
{- | An outwardly increasing circle that draws creatures, even those behind walls. -}
|
||||
sonarPulseAt :: Point2 -> Particle
|
||||
sonarPulseAt p = Particle { _ptDraw = const blank , _ptUpdate' = mvSonar 100 p }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user