Add muzzle flare

This commit is contained in:
2021-10-31 13:04:18 +00:00
parent 502be6f64f
commit a6867b1fad
9 changed files with 80 additions and 34 deletions
+2 -2
View File
@@ -703,8 +703,8 @@ boosterGun = defaultGun
aTeslaArc :: Creature -> World -> World
aTeslaArc cr w
= teslaGunFlashAt (pos +.+ 5 *.* unitVectorAtAngle dir)
$ set randGen g w
= -- teslaGunFlashAt (pos +.+ 5 *.* unitVectorAtAngle dir)
set randGen g w
& particles %~ (makeTeslaArcAt col pos dir :)
where
pos = _crPos cr +.+ (_crRad cr +1) *.* unitVectorAtAngle dir
+3 -5
View File
@@ -11,7 +11,7 @@ import Dodge.Item.Attachment.Data
import Dodge.WorldEvent.SpawnParticle
import Dodge.WorldEvent.ThingsHit
import Dodge.WorldEvent.HelperParticle
import Dodge.WorldEvent.Flash
--import Dodge.WorldEvent.Flash
import Dodge.Creature.State.Data
import Geometry
import Picture
@@ -25,9 +25,7 @@ import qualified Data.Sequence as Seq
--import qualified Data.IntMap.Strict as IM
aLaser :: Creature -> World -> World
aLaser cr w = over particles (makeLaserAt phaseV pos dir : )
$ laserGunFlashAt (pos +.+ 5 *.* unitVectorAtAngle dir)
w
aLaser cr w = over particles (makeLaserAt phaseV pos dir : ) w
where
pos = _crPos cr +.+ ((_crRad cr +3) *.* unitVectorAtAngle dir)
dir = _crDir cr
@@ -56,7 +54,7 @@ moveLaser
-> (World, Maybe Particle)
moveLaser phaseV pos dir w pt
= ( set randGen g $ hitEffect w
, Just pt {_ptDraw = const pic ,_ptUpdate = ptTimer' 0 }
, Just pt {_ptDraw = const pic ,_ptUpdate = ptSimpleTime 0 }
)
where
xp = pos +.+ 800 *.* unitVectorAtAngle dir
+9 -2
View File
@@ -42,6 +42,7 @@ import Dodge.Data.SoundOrigin
import Dodge.SoundLogic
import Dodge.Creature.Action (startReloadingWeapon)
import Dodge.WorldEvent
--import Dodge.WorldEvent.Flash
--import Dodge.WorldEvent.Cloud
import Dodge.RandomHelp
import Dodge.Item.Attachment.Data
@@ -50,6 +51,7 @@ import Dodge.Default
import Sound.Data
import Geometry
import Geometry.Vector3D
--import Color
import System.Random
import Control.Lens
@@ -313,11 +315,16 @@ modClock n chainEff eff it cr w
withMuzFlareI :: ChainEffect
withMuzFlareI f it cr w =
makeTLight 3 100 (V3 1 1 0.5) pos2 -- . muzzleFlashAt pos2
makeTLight 3 100 (V3 1 1 0.5) flashPos
. muzFlareAt (V4 5 5 0 2) flarePos dir
$ f it cr w
where
--pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
pos2 = addZ 35 $ _crPos cr +.+ (2.5 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
flarePos = addZ 20 $ _crPos cr +.+ (_crRad cr + itLength) *.* unitVectorAtAngle dir
flashPos = addZ 35 $ _crPos cr +.+ (2.5 * _crRad cr) *.* unitVectorAtAngle dir
dir = _crDir cr
itLength = _muzzleLength $ _itDimension it
{- | Applies the effect to a randomly rotated creature,
- rotation amount given by wpSpread -}
randSpreadDir :: ChainEffect