Add intersecting beams

This commit is contained in:
2022-04-06 11:40:22 +01:00
parent bca1236a85
commit de8da05bdf
9 changed files with 224 additions and 14 deletions
+5 -1
View File
@@ -1,10 +1,12 @@
module Dodge.Particle.Damage where
import Dodge.Data
import Geometry
import LensHelp
import System.Random
import Control.Monad.State
-- TODO unify particle position in a sensible manner
spawnAtBulDams :: (Point2 -> State StdGen Particle)
-> Particle -> Point2 -> [Damage]
spawnAtBulDams thespawn bt p =
@@ -21,7 +23,9 @@ simpleDam dt amount bt p =
[ Damage dt amount sp p ep NoDamageEffect
]
where
sp = head $ _ptTrail bt
sp = case bt ^? ptTrail of
Nothing -> _ptPos bt
Just xs -> head xs
bulVel = _ptVel bt
ep = sp +.+ bulVel