Add extra flare to laser
This commit is contained in:
@@ -10,7 +10,7 @@ import Dodge.Item.Weapon.LaserPath
|
||||
import Dodge.Creature.HandPos
|
||||
import Dodge.Particle.TeslaArc
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
--import Dodge.WorldEvent
|
||||
import Dodge.WorldEvent.Flash
|
||||
import Dodge.WorldEvent.Damage
|
||||
--import Dodge.Default
|
||||
--import Dodge.Item.Weapon.InventoryDisplay
|
||||
@@ -122,6 +122,7 @@ lasGunPic it =
|
||||
where
|
||||
amFrac = fractionLoadedAmmo it
|
||||
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
|
||||
|
||||
lasGunTweak :: TweakParam
|
||||
lasGunTweak = TweakParam
|
||||
{ _doTweak = thetweak
|
||||
@@ -203,7 +204,7 @@ tractorGunPic it =
|
||||
-- | assumes that the item is held
|
||||
shootTeslaArc :: Item -> Creature -> World -> World
|
||||
shootTeslaArc it cr w = w & randGen .~ g
|
||||
& particles .:~ aTeslaArcAt col newarc
|
||||
& instantParticles .:~ aTeslaArcAt col newarc
|
||||
& creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itParams . currentArc ?~ newarc
|
||||
where
|
||||
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
@@ -255,7 +256,8 @@ updateArc :: ItemParams
|
||||
updateArc = createNewArc
|
||||
|
||||
shootLaser :: Item -> Creature -> World -> World
|
||||
shootLaser it cr = instantParticles .:~ lasRayAt phasev pos dir
|
||||
shootLaser it cr = (instantParticles .:~ lasRayAt phasev pos dir)
|
||||
. flareCircleAt yellow 0.8 (pos `v2z` 25)
|
||||
where
|
||||
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
@@ -283,7 +285,6 @@ mvLaser phasev pos dir w pt
|
||||
[ setDepth 19 . color (brightX 0 0.5 yellow) $ thickLine 20 (pos:ps)
|
||||
, setDepth 19.5 . color (brightX 10 1 yellow) $ thickLine 3 (pos:ps)
|
||||
]
|
||||
|
||||
aTractorBeam :: Item -> Creature -> World -> World
|
||||
aTractorBeam _ cr w = w & props . at i ?~ tractorBeamAt i spos outpos dir power
|
||||
where
|
||||
|
||||
@@ -204,8 +204,7 @@ useGasParams nz it cr = _amCreateGas (_aoType (_itConsumption it)) (_nzPressure
|
||||
pos = _crPos cr +.+ (_nzLength nz *.* unitVectorAtAngle (_crDir cr))
|
||||
|
||||
aFlame :: Float -> Point2 -> Float -> Creature -> World -> World
|
||||
aFlame pressure pos dir cr w = w & particles .:~ aFlameParticle t pos vel (Just cid)
|
||||
aFlame pressure pos dir cr w = w & instantParticles .:~ aFlameParticle t pos vel (Just $ _crID cr)
|
||||
where
|
||||
(t,_) = randomR (99,101) (_randGen w)
|
||||
cid = _crID cr
|
||||
vel = (_crPos cr -.- _crOldPos cr) +.+ pressure *.* unitVectorAtAngle dir
|
||||
|
||||
@@ -3,20 +3,18 @@ Effects centered on creatures.
|
||||
These are typically item effects, and typical occur when an item is explictly used. -}
|
||||
module Dodge.Item.Weapon.UseEffect where
|
||||
import Dodge.Data
|
||||
--import Dodge.Zone
|
||||
--import Dodge.Picture.Layer
|
||||
import Picture
|
||||
import Geometry
|
||||
import LensHelp
|
||||
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
{- | Creates an outwardly increasing circle that draws creatures, even those behind walls. -}
|
||||
aSonarPulse :: Creature -> World -> World
|
||||
aSonarPulse cr = over particles (sonarPulseAt (_crPos cr) :)
|
||||
aSonarPulse cr = instantParticles .:~ sonarPulseAt (_crPos cr)
|
||||
{- | Creates an outwardly increasing circle that displays walls, even those behind other walls. -}
|
||||
aRadarPulse :: Creature -> World -> World
|
||||
aRadarPulse cr = over particles (radarPulseAt (_crPos cr) :)
|
||||
aRadarPulse cr = instantParticles .:~ radarPulseAt (_crPos cr)
|
||||
{- | Radar blip at a point. -}
|
||||
blipAt :: Point2 -> Color -> Int -> Particle
|
||||
blipAt p col i = Particle
|
||||
@@ -84,7 +82,7 @@ mvRadar _ _ w _ = (w, Nothing)
|
||||
-- )
|
||||
-- where
|
||||
-- pic = onLayerL [levLayer ShadowLayer, 1] $ pictures sweepPics
|
||||
-- putBlips = over worldEvents ( over particles (blips ++) . )
|
||||
-- putBlips = over worldEvents ( over instantParticles (blips ++) . )
|
||||
-- blips = map (\bp -> blipAt bp (withAlpha (0.5*globalAlpha) red) 50) circPoints
|
||||
-- circPoints = mapMaybe (\wl -> uncurry collidePointCircCorrect (_wlLine wl) r p)
|
||||
-- $ map (over wlLine swp) (IM.elems $ wallsAlongCirc p r w)
|
||||
|
||||
@@ -59,8 +59,8 @@ makeFlameExplosionAt
|
||||
-> World
|
||||
-> World
|
||||
makeFlameExplosionAt p w
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
||||
$ over particles (newFlames ++ ) w
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing w
|
||||
& instantParticles .++~ newFlames
|
||||
where
|
||||
newFlames = zipWith makeFlameWithVelAndTime velocities timers
|
||||
makeFlameWithVelAndTime vel time = aFlameParticle time p vel Nothing
|
||||
|
||||
@@ -10,10 +10,9 @@ flicker : potentially long, moving, abrupt changes in alpha
|
||||
-}
|
||||
module Dodge.WorldEvent.Flash
|
||||
( explosionFlashAt
|
||||
, laserGunFlashAt
|
||||
, teslaGunFlashAt
|
||||
, muzFlareAt
|
||||
, ptFlicker
|
||||
, flareCircleAt
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.LightSource
|
||||
@@ -25,14 +24,6 @@ import LensHelp
|
||||
|
||||
import System.Random
|
||||
|
||||
{- Cyan flash. -}
|
||||
teslaGunFlashAt :: Point3 -> World -> World
|
||||
teslaGunFlashAt = flareCircleAt cyan 0.7
|
||||
|
||||
{- Yellow flash. -}
|
||||
laserGunFlashAt :: Point3 -> World -> World
|
||||
laserGunFlashAt = flareCircleAt yellow 0.2
|
||||
|
||||
muzFlareAt :: Color -> Point3 -> Float -> World -> World
|
||||
muzFlareAt col tranv dir w = w & instantParticles .:~ theFlare
|
||||
where
|
||||
@@ -48,9 +39,9 @@ muzFlareAt col tranv dir w = w & instantParticles .:~ theFlare
|
||||
(a:b:c:d:_) = randomRs (2,20) (_randGen w)
|
||||
|
||||
flareCircleAt :: Color -> Float -> Point3 -> World -> World
|
||||
flareCircleAt col alphax tranv = particles .:~ Particle
|
||||
flareCircleAt col alphax tranv = instantParticles .:~ Particle
|
||||
{ _ptDraw = const . setLayer 1 . translate3 tranv
|
||||
$ circleSolidCol (withAlpha alphax col) (withAlpha 0 col) 30
|
||||
$ circleSolidCol (withAlpha 0 0) (withAlpha alphax col) 30
|
||||
, _ptUpdate = ptSimpleTime 1
|
||||
}
|
||||
|
||||
@@ -66,4 +57,3 @@ ptFlicker pt
|
||||
| _ptTimer pt `mod` 7 == 0 = tempLightSources
|
||||
.:~ tlsTimeRadColPos 1 70 (0.5 *.*.* xyzV4 (_ptColor pt)) (addZ 10 $ _ptPos pt)
|
||||
| otherwise = id
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ inverseShockwaveAt
|
||||
-> Float -- Push amount
|
||||
-> World
|
||||
-> World
|
||||
inverseShockwaveAt p rad dam push = particles .:~ Shockwave
|
||||
inverseShockwaveAt p rad dam push = instantParticles .:~ Shockwave
|
||||
{ _ptDraw = drawInverseShockwave
|
||||
, _ptUpdate = moveInverseShockwave
|
||||
, _ptColor = cyan
|
||||
|
||||
Reference in New Issue
Block a user