Improve machines, tweak wall ids
This commit is contained in:
+12
-2
@@ -17,6 +17,7 @@ import Dodge.Creature.Memory.Data
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Wall.Delete
|
||||
import Geometry
|
||||
import Picture
|
||||
import ShapePicture
|
||||
@@ -212,14 +213,23 @@ defaultIt = Consumable
|
||||
defaultMachine :: Machine
|
||||
defaultMachine = Machine
|
||||
{ _mcID = 0
|
||||
, _mcWallIDs = []
|
||||
, _mcUpdate = const id
|
||||
, _mcWallIDs = mempty
|
||||
, _mcUpdate = defaultMachineUpdate
|
||||
, _mcDraw = const mempty
|
||||
, _mcPos = V2 0 0
|
||||
, _mcDir = 0
|
||||
, _mcHP = 100
|
||||
, _mcSensor = 0
|
||||
, _mcDamage = []
|
||||
}
|
||||
defaultMachineUpdate :: Machine -> World -> World
|
||||
defaultMachineUpdate mc w
|
||||
| _mcHP mc < 1 = w & machines %~ IM.delete mcid
|
||||
& deleteWallIDs (_mcWallIDs mc)
|
||||
| otherwise = w & machines . ix mcid %~ ( (mcDamage .~ []) . (mcHP -~ dams) )
|
||||
where
|
||||
dams = sum $ map _dmAmount $ _mcDamage mc
|
||||
mcid = _mcID mc
|
||||
|
||||
defaultDrawButton :: Color -> Button -> SPic
|
||||
defaultDrawButton col bt =
|
||||
|
||||
Reference in New Issue
Block a user