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