Add dust on bullet wall hit

This commit is contained in:
2021-09-13 12:23:51 +01:00
parent b27c174d93
commit 29f048cfdd
15 changed files with 93 additions and 68 deletions
+21 -11
View File
@@ -10,14 +10,14 @@ import Picture
import Control.Lens
makeCloudAt
:: Float -- ^ radius
:: (Cloud -> Picture) -- ^ draw function
-> Float -- ^ radius
-> Int -- ^ timer
-> Float -- ^ resting altitude
-> (Cloud -> Picture) -- ^ draw function
-> Point3 -- start position
-> World
-> World
makeCloudAt rad t alt drawFunc p w = w & clouds %~ (theCloud :)
makeCloudAt drawFunc rad t alt p w = w & clouds %~ (theCloud :)
where
theCloud = Cloud
{ _clPos = p
@@ -30,6 +30,16 @@ makeCloudAt rad t alt drawFunc p w = w & clouds %~ (theCloud :)
, _clEffect = const id
}
smokeCloudAt
:: Color
-> Float -- ^ radius
-> Int -- ^ timer
-> Float -- ^ resting altitude
-> Point3 -- start position
-> World
-> World
smokeCloudAt col = makeCloudAt (drawCloudWith (4/3) 800 col)
drawCloudWith :: Float -> Float -> Color -> Cloud -> Picture
drawCloudWith radMult fadet col cl
= setLayer 2
@@ -39,23 +49,23 @@ drawCloudWith radMult fadet col cl
a = min 1 $ fromIntegral (_clTimer cl) / fadet
makeThickSmokeAt :: Point3 -> World -> World
makeThickSmokeAt = makeCloudAt 3 50 30 (drawCloudWith 4 50 black)
makeThickSmokeAt = makeCloudAt (drawCloudWith 4 50 black) 3 50 30
makeThinSmokeAt :: Point3 -> World -> World
makeThinSmokeAt = makeCloudAt 5 400 50 (drawCloudWith 4 400 (withAlpha 0.05 black))
makeThinSmokeAt = makeCloudAt (drawCloudWith 4 400 (withAlpha 0.05 black)) 5 400 50
makeStartCloudAt :: Point3 -> World -> World
--makeSmokeCloudAt = makeCloudAt 10 200 (drawCloudWith 2 200 (greyN 0.5))
makeStartCloudAt = makeCloudAt 10 400 5 (drawCloudWith 2 800 white)
makeStartCloudAt = makeCloudAt (drawCloudWith 2 800 white) 10 400 5
makeSmokeCloudAt :: Point3 -> World -> World
--makeSmokeCloudAt = makeCloudAt 10 200 (drawCloudWith 2 200 (greyN 0.5))
makeSmokeCloudAt = makeCloudAt 15 400 40 (drawCloudWith (4/3) 800 (greyN 0.5))
shellTrailCloud :: Point3 -> World -> World
----makeSmokeCloudAt = makeCloudAt 10 200 (drawCloudWith 2 200 (greyN 0.5))
shellTrailCloud = makeCloudAt (drawCloudWith (4/3) 800 (greyN 0.5)) 15 400 40
makeFlamerSmokeAt :: Float -> Point3 -> World -> World
makeFlamerSmokeAt x = makeCloudAt 6 200 40 (drawCloudWith 4 300 (greyN x))
makeFlamerSmokeAt x = makeCloudAt (drawCloudWith 4 300 (greyN x)) 6 200 40
spawnSmokeAtCursor :: World -> World
spawnSmokeAtCursor w = makeSmokeCloudAt (V3 x y 20) w
spawnSmokeAtCursor w = shellTrailCloud (V3 x y 20) w
where
V2 x y = mouseWorldPos w
+1 -1
View File
@@ -85,7 +85,7 @@ flashFlareAt col alphax (V2 x y) = Particle
}
explosionFlashAt :: Point2 -> World -> World
explosionFlashAt p = over tempLightSources ((:) $ tLightFade 20 150 intensityFunc p)
explosionFlashAt p = over tempLightSources ((:) $ tLightTimedIntensity 20 150 intensityFunc p)
where
intensityFunc x
| x < 10 = 1 / (10 - fromIntegral x)