This commit is contained in:
2022-07-19 21:51:37 +01:00
parent 0edc1cfe11
commit db44d5d6ce
7 changed files with 36 additions and 36 deletions
+2 -14
View File
@@ -10,16 +10,11 @@ module Dodge.Creature.Inanimate
import Dodge.Data
import Dodge.Creature.Lamp
import Dodge.WorldEvent.Explosion
import Dodge.Creature.Picture
import Dodge.Spark
import Dodge.Default
import Dodge.Creature.State
import Picture
import qualified IntMapHelp as IM
import Geometry
--import Geometry.Data
--import Geometry.Vector3D
import Shape
import Dodge.SoundLogic
import LensHelp
@@ -30,11 +25,7 @@ barrel :: Creature
barrel = defaultInanimate
{ _crUpdate = updateBarrel
, _crHP = 500
, _crType = DrawnCreature $ picAtCrPos $ setDepth 20 $ pictures
[ color orange $ circleSolid 10
, setDepth 0.049 . color (greyN 0.5) $ circleSolid 8
, color (greyN 0.5) $ circleSolid 8
]
, _crType = Barreloid
, _crState = defaultState
{_csSpState = Barrel []
}
@@ -45,10 +36,7 @@ explosiveBarrel :: Creature
explosiveBarrel = defaultInanimate
{ _crUpdate = updateExpBarrel
, _crHP = 400
, _crType = DrawnCreature $ shapeAtCrPos
. colorSH orange
. upperPrismPoly 20
$ polyCirc 4 10
, _crType = Barreloid
, _crState = defaultState
{_csSpState = Barrel []
}
+1 -14
View File
@@ -5,19 +5,14 @@ module Dodge.Creature.Lamp
import Dodge.Data
import Dodge.Material.Sound
import Dodge.Default
import Dodge.Creature.Picture
import Dodge.LightSource
import Dodge.WorldEvent.Flash
import Dodge.WorldEvent.Sound
import Dodge.Creature.State
import Geometry
import Picture
import Polyhedra
import qualified IntMapHelp as IM
import LensHelp
--import qualified Streaming.Prelude as S
colorLamp
:: Point3 -- color of lamp
-> Float -- height of lamp
@@ -25,7 +20,7 @@ colorLamp
colorLamp col h = defaultInanimate
{ _crUpdate = initialiseColorLamp col h
, _crHP = 100
, _crType = DrawnCreature $ picAtCrPosNoRot (lampCrPic h)
, _crType = Lampoid h
, _crRad = 3
, _crMass = 3
}
@@ -33,14 +28,6 @@ colorLamp col h = defaultInanimate
lamp :: Float -> Creature
lamp = colorLamp 0.75
lampCrPic :: Float -> Picture
lampCrPic h = pictures
[ setLayer BloomLayer (setDepth h . color white $ circleSolid 3)
, foldMap (polyToTris . map f) $ boxXYZnobase 5 5 (h-1)
]
where
f pos = Verx (pos -.-.- V3 2.5 2.5 0) blue [] BottomLayer polyNum
initialiseColorLamp :: Point3 -> Float -> Creature -> World -> World
initialiseColorLamp col h cr w = w
& lightSources . at lsid ?~ lsColPosID col (addZ h $ _crPos cr) lsid
+1 -1
View File
@@ -63,7 +63,7 @@ checkDeath cr w
where
removecr
| _crID cr == 0 = (creatures . ix (_crID cr) . crUpdate .~ const id)
. (creatures . ix (_crID cr) . crType .~ DrawnCreature (const mempty))
. (creatures . ix (_crID cr) . crType .~ NonDrawnCreature)
. (creatures . ix (_crID cr) . crHP .~ 0)
-- hack to get around player creature being killed but left with more than 0 hp
| otherwise = creatures . at (_crID cr) .~ Nothing