Put config/targeting pictures in sensible places, tweak main loop
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
module Dodge.Creature.Picture.Awareness where
|
||||
import Dodge.Data
|
||||
import Dodge.Clock
|
||||
import Picture
|
||||
import Geometry
|
||||
|
||||
import qualified Data.Vector as V
|
||||
|
||||
creatureDisplayText :: World -> Creature -> Picture
|
||||
creatureDisplayText w cr = setLayer DebugLayer
|
||||
. setDepth 20
|
||||
. translate x y
|
||||
. color white
|
||||
. rotate (0.5 * pi)
|
||||
-- . rotate (argV v - 0.5 * pi)
|
||||
. scale theScale theScale
|
||||
. stackText
|
||||
$ clockCycle 25 (V.fromList
|
||||
[ \cr' -> [crDisplayVigilance cr']
|
||||
, \cr' -> [crDisplayAwareness cr']
|
||||
]
|
||||
) w cr
|
||||
where
|
||||
campos = _cameraViewFrom w
|
||||
theScale = 0.15 / _cameraZoom w
|
||||
cpos = _crPos cr
|
||||
v = cpos -.- campos
|
||||
(V2 x y) = campos +.+ v +.+ _crRad cr *.* normalizeV v
|
||||
|
||||
crDisplayAwareness :: Creature -> String
|
||||
crDisplayAwareness cr
|
||||
| isSuspicious = "?"
|
||||
| isCognizant = "!"
|
||||
| otherwise = "."
|
||||
where
|
||||
imAwarenesses = _cpAwareness (_crPerception cr)
|
||||
isSuspicious = any f imAwarenesses && not (null imAwarenesses)
|
||||
isCognizant = any g imAwarenesses && not (null imAwarenesses)
|
||||
f (Suspicious _) = True
|
||||
f _ = False
|
||||
g (Cognizant _) = True
|
||||
g _ = False
|
||||
|
||||
crDisplayVigilance :: Creature -> String
|
||||
crDisplayVigilance = show . _cpVigilance . _crPerception
|
||||
Reference in New Issue
Block a user