Allow tweaking z buffer when rendering polygon, improve explosion render
This commit is contained in:
@@ -26,29 +26,29 @@ import Control.Lens
|
||||
defaultInanimate :: Creature
|
||||
defaultInanimate = defaultCreature & crActionPlan .~ Inanimate
|
||||
|
||||
lamp :: Creature
|
||||
lamp = defaultInanimate
|
||||
{ _crUpdate = initialiseLamp
|
||||
lamp :: Float -> Creature
|
||||
lamp h = defaultInanimate
|
||||
{ _crUpdate = initialiseLamp h
|
||||
, _crHP = 100
|
||||
, _crPict = picAtCrPos lampPic
|
||||
, _crPict = picAtCrPos (lampPic h)
|
||||
, _crRad = 3
|
||||
, _crMass = 3
|
||||
}
|
||||
lampPic :: Picture
|
||||
lampPic = pictures
|
||||
[ pictures . map (Poly3D 0 . map ((, blue) . (-.-.- (2.5,2.5,0)))) $ boxXYZ 5 5 99
|
||||
, setDepth (100) $ color white $ circleSolid 3
|
||||
lampPic :: Float -> Picture
|
||||
lampPic h = pictures
|
||||
[ pictures . map (Poly3D 0 . map ((, blue) . (-.-.- (2.5,2.5,0)))) $ boxXYZ 5 5 (h-1)
|
||||
, setDepth h $ color white $ circleSolid 3
|
||||
]
|
||||
|
||||
initialiseLamp :: CRUpdate
|
||||
initialiseLamp w (f,g) cr = ( (addLS . f , g), Just $ cr & crUpdate .~ updateLamp i)
|
||||
initialiseLamp :: Float -> CRUpdate
|
||||
initialiseLamp h w (f,g) cr = ( (addLS . f , g), Just $ cr & crUpdate .~ updateLamp h i)
|
||||
where
|
||||
i = IM.newKey $ _lightSources $ f w -- to give different lights different keys
|
||||
addLS = over lightSources (IM.insert i (lightAt (x,y,20) i))
|
||||
addLS = over lightSources (IM.insert i (lightAt (x,y,h) i))
|
||||
(x,y) = _crPos cr
|
||||
|
||||
updateLamp :: Int -> CRUpdate
|
||||
updateLamp i = unrandUpdate handleLS internalUpdate
|
||||
updateLamp :: Float -> Int -> CRUpdate
|
||||
updateLamp h i = unrandUpdate handleLS internalUpdate
|
||||
where
|
||||
handleLS cr w
|
||||
| _crHP cr < 0 = explosionFlashAt cPos
|
||||
@@ -56,7 +56,7 @@ updateLamp i = unrandUpdate handleLS internalUpdate
|
||||
| otherwise = w & lightSources . ix i . lsPos .~ f cPos
|
||||
where
|
||||
cPos = _crPos cr
|
||||
f (x,y) = (x,y,120)
|
||||
f (x,y) = (x,y,h)
|
||||
internalUpdate cr
|
||||
| _crHP cr < 0 = Nothing
|
||||
| otherwise = Just $ doDamage cr
|
||||
|
||||
Reference in New Issue
Block a user