Cleanup, add spark to bullet turret hit
This commit is contained in:
@@ -11,11 +11,11 @@ import Dodge.Wall.Dust
|
|||||||
import Dodge.Particle.Spark
|
import Dodge.Particle.Spark
|
||||||
import Geometry
|
import Geometry
|
||||||
import Color
|
import Color
|
||||||
|
import LensHelp
|
||||||
|
|
||||||
import Control.Lens
|
|
||||||
damageWall :: DamageType -> Wall -> World -> World
|
damageWall :: DamageType -> Wall -> World -> World
|
||||||
damageWall dt wl = case _wlStructure wl of
|
damageWall dt wl = case _wlStructure wl of
|
||||||
MachinePart mcid -> machines . ix mcid . mcDamage %~ (dt :)
|
MachinePart mcid -> wallEff dt wl . (machines . ix mcid . mcDamage .:~ dt)
|
||||||
BlockPart blid -> wallEff dt wl . (blocks . ix blid %~ damageBlockWith dt)
|
BlockPart blid -> wallEff dt wl . (blocks . ix blid %~ damageBlockWith dt)
|
||||||
CreaturePart crid f -> f dt wl crid
|
CreaturePart crid f -> f dt wl crid
|
||||||
_ -> wallEff dt wl
|
_ -> wallEff dt wl
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Geometry
|
|||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|
||||||
wlDustAt :: Wall -> Point2 -> World -> World
|
wlDustAt :: Wall -> Point2 -> World -> World
|
||||||
wlDustAt wl p = smokeCloudAt dustcol 20 200 1 (addZ 20 p)
|
wlDustAt wl = smokeCloudAt dustcol 20 200 1 . addZ 20
|
||||||
where
|
where
|
||||||
dustcol = _wlColor wl & _4 .~ 1
|
dustcol = _wlColor wl & _4 .~ 1
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ import Dodge.Data
|
|||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
import Picture
|
import Picture
|
||||||
|
import LensHelp
|
||||||
|
|
||||||
import Control.Lens
|
--import Control.Lens
|
||||||
import System.Random
|
import System.Random
|
||||||
|
|
||||||
makeCloudAt
|
makeCloudAt
|
||||||
@@ -23,9 +24,7 @@ makeCloudAt
|
|||||||
-> Point3 -- start position
|
-> Point3 -- start position
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
makeCloudAt drawFunc rad t alt p = clouds %~ (theCloud :)
|
makeCloudAt drawFunc rad t alt p = clouds .:~ Cloud
|
||||||
where
|
|
||||||
theCloud = Cloud
|
|
||||||
{ _clPos = p
|
{ _clPos = p
|
||||||
, _clVel = V3 0 0 0
|
, _clVel = V3 0 0 0
|
||||||
, _clPict = drawFunc
|
, _clPict = drawFunc
|
||||||
|
|||||||
@@ -34,9 +34,8 @@ makePoisonExplosionAt
|
|||||||
-> World
|
-> World
|
||||||
makePoisonExplosionAt p w
|
makePoisonExplosionAt p w
|
||||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
||||||
$ foldr (makeGasCloud p) w vels
|
$ foldr (makeGasCloud p) w
|
||||||
where
|
$ replicateM 25 (randInCirc 2) & evalState $ _randGen w
|
||||||
vels = replicateM 25 (randInCirc 2) & evalState $ _randGen w
|
|
||||||
-- just change the number after replicateM to get more or less clouds
|
-- just change the number after replicateM to get more or less clouds
|
||||||
-- suggested change: use random positions, offset from p, rather than velocities
|
-- suggested change: use random positions, offset from p, rather than velocities
|
||||||
-- so, p +.+ randomOffset
|
-- so, p +.+ randomOffset
|
||||||
@@ -93,4 +92,3 @@ makeExplosionAt p w
|
|||||||
newFs = zipWith5 mF fPs zs (fmap (3 *.*) fVs') sizes times
|
newFs = zipWith5 mF fPs zs (fmap (3 *.*) fVs') sizes times
|
||||||
addFlames w' = foldr ($) w' newFs
|
addFlames w' = foldr ($) w' newFs
|
||||||
pushAgainstWalls q = maybe q (uncurry (+.+)) $ reflectPointWalls p q $ wallsNearPoint q w
|
pushAgainstWalls q = maybe q (uncurry (+.+)) $ reflectPointWalls p q $ wallsNearPoint q w
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
{- Helper functions for particles. -}
|
{- Helper functions for particles. -}
|
||||||
module Dodge.WorldEvent.HelperParticle
|
module Dodge.WorldEvent.HelperParticle
|
||||||
( ptSimpleTime
|
( ptSimpleTime
|
||||||
)
|
) where
|
||||||
where
|
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
|
||||||
{- A simple timer update for particles. -}
|
{- A simple timer update for particles. -}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ killBulletUpdate :: World -> Particle -> (World,Maybe Particle)
|
|||||||
killBulletUpdate w pt
|
killBulletUpdate w pt
|
||||||
| _ptTimer pt <= 0 = (w,Nothing)
|
| _ptTimer pt <= 0 = (w,Nothing)
|
||||||
| otherwise = (w
|
| otherwise = (w
|
||||||
,Just $ pt & ptTimer -~ 1
|
, Just $ pt & ptTimer -~ 1
|
||||||
& ptTrail %~ (\(x:xs) -> x:x:xs)
|
& ptTrail %~ (\(x:xs) -> x:x:xs)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user