Commit before improving item targeting

This commit is contained in:
2022-02-22 10:47:15 +00:00
parent ff84363a13
commit 69490bb984
12 changed files with 83 additions and 50 deletions
+26 -1
View File
@@ -2,14 +2,15 @@ module Dodge.Particle.Bullet.Spawn
( aGenBulAt
, aDelayedBulAt
, aCurveBulAt
, accelBulAt
) where
import Dodge.Data
import Dodge.Particle.Bullet.Draw
import Dodge.Particle.Bullet.Update
import Geometry
import Picture
import LensHelp
import Control.Lens
import Data.Bifunctor
aGenBulAt
@@ -80,3 +81,27 @@ aCurveBulAt maycid col pos control targ hiteff width = BulletPt
where
setVel pt = pt & ptVel .~ bf (fromIntegral $ _ptTimer pt - 1) -.- bf (fromIntegral $ _ptTimer pt)
bf t = bQuadToF (pos,control,targ) $ (100 - t) * 0.05
accelBulAt
:: Maybe Int -- ^ Pass-through creature id
-> Color
-> Point2 -- ^ Start position
-> Point2 -- ^ Velocity
-> Point2 -- ^ Acceleration
-> HitEffect
-> Float -- ^ Bullet width
-> Particle
accelBulAt maycid col pos vel acc hiteff width = 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 .+.+~ acc