Add line shadow shader

This commit is contained in:
2021-06-26 22:20:41 +02:00
parent 726cd425f2
commit 06f22a3ea5
21 changed files with 128 additions and 74 deletions
+7 -6
View File
@@ -33,17 +33,16 @@ lamp = defaultInanimate
}
lampPic :: Picture
lampPic = pictures
[ setDepth (0.09) $ color white $ p
, setDepth (0) $ color yellow $ p
[ setDepth (0.049) $ color white $ polygon $ rectNSEW 5 (-5) 5 (-5)
, setDepth (0) $ color white $ circleSolid 3
]
where
p = pictures [circleSolid 3, polygon $ rectNSEW 5 0 5 0]
initialiseLamp :: CRUpdate
initialiseLamp w (f,g) cr = ( (addLS . f , g), Just $ cr & crUpdate .~ updateLamp i)
where
i = IM.newKey $ _lightSources $ f w -- to give different lights different keys
addLS = over lightSources (IM.insert i (lightAt (_crPos cr) i))
addLS = over lightSources (IM.insert i (lightAt (x,y,0) i))
(x,y) = _crPos cr
updateLamp :: Int -> CRUpdate
updateLamp i = unrandUpdate handleLS internalUpdate
@@ -65,6 +64,7 @@ barrel = defaultInanimate
, _crHP = 500
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
[ color orange $ circleSolid 10
, setDepth 0.049 . color (greyN 0.5) $ circleSolid 8
, color (greyN 0.5) $ circleSolid 8
]
, _crState = defaultState
@@ -77,8 +77,9 @@ explosiveBarrel :: Creature
explosiveBarrel = defaultInanimate
{ _crUpdate = updateExpBarrel
, _crHP = 400
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
, _crPict = picAtCrPos $ pictures
[ color red $ circleSolid 8
, setDepth 0.049 . color (greyN 0.5) $ circleSolid 10
, color orange $ circleSolid 10
]
, _crState = defaultState