Move bullets into own data type

This commit is contained in:
2022-07-16 21:15:25 +01:00
parent 22adcb89e0
commit 301946ff8f
21 changed files with 216 additions and 108 deletions
+4 -4
View File
@@ -15,7 +15,7 @@ import Data.Maybe
--import Control.Lens
useAmmoParams :: Maybe Float -> Item -> Creature -> World -> World
useAmmoParams vfact it cr w = w & instantParticles .:~ aBulAt
useAmmoParams vfact it cr w = w & instantBullets .:~ aBulAt
vfact
thetraj -- extra update
Nothing -- color (default)
@@ -34,15 +34,15 @@ useAmmoParams vfact it cr w = w & instantParticles .:~ aBulAt
BasicBulletTrajectory -> id
MagnetTrajectory -> fromMaybe id $ do
tpos <- it ^? itTargeting . tgPos . _Just
return $ \pt -> pt & ptVel .+.+~ 5 *.* normalizeV (tpos -.- head (_ptTrail pt))
return $ \pt -> pt & buVel .+.+~ 5 *.* normalizeV (tpos -.- head (_buTrail pt))
FlechetteTrajectory -> fromMaybe id $ do
tpos <- it ^? itTargeting . tgPos . _Just
return $ \pt -> pt & ptVel %~ vecTurnTo 0.2 (head $ _ptTrail pt) tpos
return $ \pt -> pt & buVel %~ vecTurnTo 0.2 (head $ _buTrail pt) tpos
BezierTrajectory -> fromMaybe id $ do
tpos <- it ^? itTargeting . tgPos . _Just
let bf t = bQuadToF (sp,mouseWorldPos w,tpos) $ (100 - t) * 0.05
return $ \pt -> pt
& ptVel .~ bf (fromIntegral $ _ptTimer pt - 1) -.- bf (fromIntegral $ _ptTimer pt)
& buVel .~ bf (fromIntegral $ _buTimer pt - 1) -.- bf (fromIntegral $ _buTimer pt)
---- this shouldn't really be used
loadedAmmo :: Item -> Int
+2 -2
View File
@@ -10,7 +10,7 @@ import Geometry.Data
basicBullet :: AmmoType
basicBullet = BulletAmmo
{ _amString = "BASIC"
, _amBulEff = expireAndDamage basicBulDams
, _amBulEff = expireAndDamage' basicBulDams
, _amBulWth = 2
, _amBulVel = V2 50 0
, _amBulTraj = BasicBulletTrajectory
@@ -18,7 +18,7 @@ basicBullet = BulletAmmo
hvBullet :: AmmoType
hvBullet = BulletAmmo
{ _amString = "HVBULLET"
, _amBulEff = expireAndDamage hvBulDams
, _amBulEff = expireAndDamage' hvBulDams
, _amBulWth = 6
, _amBulVel = V2 80 0
, _amBulTraj = BasicBulletTrajectory
+1 -1
View File
@@ -63,7 +63,7 @@ bangRod = defaultBulletWeapon
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 30
& itConsumption . laAmmoType . amBulEff .~ expireAndDamage heavyBulDams
& itConsumption . laAmmoType . amBulEff .~ expireAndDamage' heavyBulDams
elephantGun :: Item
elephantGun = bangRod
& itType . iyBase .~ HELD ELEPHANTGUN