Refactor creature draw, pass World to function
This commit is contained in:
@@ -4,6 +4,7 @@ Inanimate objects such as lamps, barrels, etc
|
||||
module Dodge.Creature.Inanimate
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Creature.Picture
|
||||
--import Dodge.Creature.Stance.Data
|
||||
import Dodge.Creature.State.Data
|
||||
import Dodge.Picture.Layer
|
||||
@@ -25,7 +26,7 @@ lamp :: Creature
|
||||
lamp = defaultInanimate
|
||||
{ _crUpdate = initialiseLamp
|
||||
, _crHP = 100
|
||||
, _crPict = \ _ -> onLayer CrLayer $ color white $ circleSolid 3
|
||||
, _crPict = picAtCrPos $ onLayer CrLayer $ color white $ circleSolid 3
|
||||
, _crRad = 3
|
||||
, _crMass = 3
|
||||
}
|
||||
@@ -53,7 +54,7 @@ barrel :: Creature
|
||||
barrel = defaultInanimate
|
||||
{ _crUpdate = updateBarrel
|
||||
, _crHP = 500
|
||||
, _crPict = \ _ -> onLayer CrLayer $ pictures
|
||||
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
|
||||
[ color orange $ circleSolid 10
|
||||
, color (greyN 0.5) $ circleSolid 8
|
||||
]
|
||||
@@ -67,7 +68,7 @@ explosiveBarrel :: Creature
|
||||
explosiveBarrel = defaultInanimate
|
||||
{ _crUpdate = updateExpBarrel
|
||||
, _crHP = 400
|
||||
, _crPict = \ _ -> onLayer CrLayer $ pictures
|
||||
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
|
||||
[ color red $ circleSolid 8
|
||||
, color orange $ circleSolid 10
|
||||
]
|
||||
|
||||
@@ -4,6 +4,7 @@ Takes into account damage etc. -}
|
||||
module Dodge.Creature.Picture
|
||||
( basicCrPict
|
||||
, circLine
|
||||
, picAtCrPos
|
||||
) where
|
||||
import Dodge.Data
|
||||
--import Dodge.Creature.Stance.Data
|
||||
@@ -19,8 +20,9 @@ import qualified Data.IntMap.Strict as IM
|
||||
basicCrPict
|
||||
:: Color -- ^ Creature color
|
||||
-> Creature
|
||||
-> World
|
||||
-> Picture
|
||||
basicCrPict col cr = pictures
|
||||
basicCrPict col cr _ = uncurry translate (_crPos cr) $ rotate (_crDir cr) $ pictures
|
||||
[ onLayer CrLayer . piercingMod $ bluntScale naked
|
||||
-- , drawAwakeLevel cr
|
||||
, drawEquipment cr
|
||||
@@ -72,3 +74,6 @@ drawEquipment cr = pictures $ map f $ IM.toList (_crInv cr)
|
||||
|
||||
circLine :: Float -> Picture
|
||||
circLine x = line [(0,0),(x,0)]
|
||||
|
||||
picAtCrPos :: Picture -> Creature -> World -> Picture
|
||||
picAtCrPos thePic cr _ = uncurry translate (_crPos cr) $ rotate (_crDir cr) thePic
|
||||
|
||||
Reference in New Issue
Block a user