Add light source to flamer flames

This commit is contained in:
2021-08-28 15:10:14 +01:00
parent 59cf6b84e2
commit 4e97a1998c
+12 -5
View File
@@ -4,6 +4,7 @@ Creation of particles in the world.
module Dodge.WorldEvent.SpawnParticle
where
import Dodge.Data
import Dodge.Default
import Dodge.Creature.State.Data
import Dodge.Base
import Dodge.Base.Zone
@@ -62,9 +63,6 @@ drawFlame rotd pt = thePic
, aPic 1 prot2 18 (V2 (scaleChange + 1) 2 ) $ V4 2 (-1) (-1) 0.5
, aPic 1 prot 19 (V2 (scaleChange + 0.5) 1) $ V4 1 0.5 0 2
, aPic 1 prot3 20 (V2 scaleChange 0.5 ) $ V4 1 1 1 1
--, aPic 3 prot2 18 (V2 (scaleChange + 1) 2 ) red
--, aPic 4 prot 19 (V2 (scaleChange + 0.5) 1.5) orange
--, aPic 5 prot3 20 (V2 scaleChange 1 ) white
]
aPic :: Int -> (Point2 -> Point2) -> Float -> Point2 -> Color -> Picture
aPic lay offset depth (V2 scalex scaley) col
@@ -96,11 +94,20 @@ moveFlame rotd w pt
| otherwise = case thingsHitExceptCr (_btPassThrough' pt) sp ep w of
((_,E3x1 _):_) -> (soundAndGlare damcrs , mvPt')
(thing@(p,E3x2 wl):_) -> (fst $ hiteff [thing] damcrs , rfl wl p)
_ -> (soundAndGlare damcrs , mvPt)
_ -> (glare $ soundAndGlare damcrs , mvPt)
where
time = _btTimer' pt
soundAndGlare = soundFrom Flame fireSound 2 500 -- . over worldEvents ((.) $ flameGlareAt ep)
sp = _btPos' pt
glare
| time `mod` 5 == 0
= tempLightSources %~ (theTLS :)
| otherwise = id
theTLS = defaultTLS
{ _tlsPos = V3 x y 15
, _tlsRad = 70
, _tlsIntensity = V3 0.5 0 0
}
sp@(V2 x y) = _btPos' pt
vel = _btVel' pt
ep = sp +.+ vel
mvPt = Just $ pt {_btTimer' = time - 1, _btPos' = ep