Separate and reify laser beams
This commit is contained in:
+10
-43
@@ -3,19 +3,10 @@ import Dodge.Data
|
||||
import Dodge.Flame
|
||||
import Dodge.Tesla.Arc
|
||||
import Dodge.Item.Location
|
||||
import Dodge.WorldEvent.Damage
|
||||
import Dodge.WorldEvent.HelperParticle
|
||||
import Dodge.Item.Weapon.LaserPath
|
||||
import Geometry
|
||||
import LensHelp
|
||||
import Picture
|
||||
--import RandomHelp
|
||||
--import Dodge.Zone
|
||||
--import Dodge.Base.Collide
|
||||
--import Shape
|
||||
|
||||
--import Data.List (sortOn)
|
||||
--import MonadHelp
|
||||
import Data.Maybe
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
@@ -36,13 +27,13 @@ flameBeamCombine (p,(a,b,_),(x,y,_))
|
||||
lasBeamCombine :: (Point2,(Point2,Point2,Beam),(Point2,Point2,Beam))
|
||||
-> World -> World
|
||||
lasBeamCombine (p,(a,b,_),(x,y,_))
|
||||
= instantParticles .:~ lasRayAt yellow 11 1 p (argV (normalizeV (b-.-a)+.+normalizeV (y-.-x)))
|
||||
= lasers .:~ lasRayAt yellow 11 1 p (argV (normalizeV (b-.-a)+.+normalizeV (y-.-x)))
|
||||
|
||||
splitBeamCombine :: (Point2,(Point2,Point2,Beam),(Point2,Point2,Beam))
|
||||
-> World -> World
|
||||
splitBeamCombine (p,(a,b,_),(x,y,_))
|
||||
= (instantParticles .:~ lasRayAt yellow 11 1 p (dir+0.5*pi))
|
||||
. (instantParticles .:~ lasRayAt yellow 11 1 p (dir-0.5*pi))
|
||||
= (lasers .:~ lasRayAt yellow 11 1 p (dir+0.5*pi))
|
||||
. (lasers .:~ lasRayAt yellow 11 1 p (dir-0.5*pi))
|
||||
where
|
||||
dir = argV (normalizeV (b-.-a)+.+normalizeV (y-.-x))
|
||||
|
||||
@@ -58,35 +49,11 @@ teslaBeamCombine (p,(a,b,bm),(x,y,_)) w
|
||||
Nothing -> error "tried to get item use teslaBeamCombine that doesn't exist"
|
||||
Just itm -> itm
|
||||
|
||||
lasRayAt :: Color -> Int -> Float -> Point2 -> Float -> Particle
|
||||
lasRayAt col dam phasev pos dir = LaserParticle
|
||||
{ _ptUpdate = mvLaser phasev pos dir
|
||||
, _ptRange = 800
|
||||
, _ptDamage = dam
|
||||
, _ptPhaseV = phasev
|
||||
, _ptColor = col
|
||||
, _ptPoints = []
|
||||
lasRayAt :: Color -> Int -> Float -> Point2 -> Float -> LaserStart
|
||||
lasRayAt col dam phasev pos dir = LaserStart
|
||||
{ _lpDamage = dam
|
||||
, _lpPhaseV = phasev
|
||||
, _lpPos = pos
|
||||
, _lpDir = dir
|
||||
, _lpColor = col
|
||||
}
|
||||
mvLaser :: Float -- ^ Phase velocity, controls deflection through windows
|
||||
-> Point2
|
||||
-> Float
|
||||
-> World
|
||||
-> Particle
|
||||
-> (World, Maybe Particle)
|
||||
mvLaser phasev sp dir w pt =
|
||||
( damThingHitWith (\p1 p2 p3 -> Damage LASERING dam p1 p2 p3 NoDamageEffect) sp xp thHit w
|
||||
, Just pt {_ptPoints = sp:ps ,_ptUpdate = ptSimpleTime 0 }
|
||||
)
|
||||
where
|
||||
dam = _ptDamage pt
|
||||
xp = sp +.+ 800 *.* unitVectorAtAngle dir
|
||||
(thHit, ps) = reflectLaserAlong phasev sp xp w
|
||||
|
||||
drawLaser :: Particle -> Picture
|
||||
drawLaser pt =
|
||||
setLayer BloomNoZWrite $ pictures
|
||||
[ setDepth 19.5 . color (brightX 10 1 col) $ thickLine 3 ps
|
||||
]
|
||||
where
|
||||
col = _ptColor pt
|
||||
ps = _ptPoints pt
|
||||
|
||||
Reference in New Issue
Block a user