Add new bullet trajectories

This commit is contained in:
2022-02-28 13:19:07 +00:00
parent 1e5f24c8a1
commit 419fcd0ff0
18 changed files with 285 additions and 101 deletions
+26
View File
@@ -7,6 +7,7 @@ module Dodge.Particle.Bullet.Spawn
import Dodge.Data
import Dodge.Particle.Bullet.Draw
import Dodge.Particle.Bullet.Update
import Dodge.Movement.Turn
import Geometry
import Picture
import LensHelp
@@ -105,3 +106,28 @@ accelBulAt maycid col pos vel acc hiteff width = BulletPt
}
where
setVel pt = pt & ptVel .+.+~ acc
turnBulAt
:: Maybe Int -- ^ Pass-through creature id
-> Color
-> Point2 -- ^ Start position
-> Point2 -- ^ Velocity
-> Point2 -- ^ Acceleration
-> HitEffect
-> Float -- ^ Bullet width
-> Point2 -- ^ Target position
-> Particle
turnBulAt maycid col pos vel acc hiteff width tpos = BulletPt
{ _ptDraw = drawBul
, _ptUpdate = \w -> mvBullet w . setVel
, _ptVel = vel
, _btDrag = 1
, _ptColor = col
, _ptTrail = [pos]
, _ptCrIgnore = maycid
, _ptWidth = width
, _ptTimer = 100
, _ptHitEff = hiteff
}
where
setVel pt = pt & ptVel %~ vecTurnTo 0.1 (head $ _ptTrail pt) tpos