This commit is contained in:
2025-01-08 20:28:26 +00:00
parent 97317a621b
commit 01ed3ce045
+4 -18
View File
@@ -138,13 +138,10 @@ makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
where where
s = min 10 (0.5 * magV (_buVel bu)) s = min 10 (0.5 * magV (_buVel bu))
xs = take 5 $ randomRs (- s, s) $ _randGen w xs = take 5 $ randomRs (- s, s) $ _randGen w
f x = f x = bu & buVel %~ g x
bu & buVel %~ g x
-- & buTimer .~ 97
& buPayload .~ BulSpark & buPayload .~ BulSpark
& buWidth .~ 0.5 & buWidth .~ 0.5
& buDamages & buDamages .~ [Damage PIERCING 25 0 0 0 $ PushBackDamage 2]
.~ [Damage PIERCING 25 0 0 0 $ PushBackDamage 2]
g x v = v +.+ x *.* normalizeV (vNormal v) g x v = v +.+ x *.* normalizeV (vNormal v)
hitEffFromBul :: World -> Bullet -> (World, Bullet) hitEffFromBul :: World -> Bullet -> (World, Bullet)
@@ -156,24 +153,13 @@ hitEffFromBul w bu = case _buEffect bu of
return return
( w ( w
, bu , bu
& buPos .~ hp +.+ normalizeV (_buPos bu -.- hp) & buPos .~ hp + normalizeV (_buPos bu - hp)
& buVel %~ reflectIn dir & buVel %~ reflectIn dir
) )
-- BounceBullet -> case List.safeHead hitstream of
-- Nothing -> (w, moveBullet bu)
-- Just (hp, crwl) -> fromMaybe (expireAndDamage bu hitstream w) $ do
-- dir <- bounceDir (hp, crwl)
-- return
-- ( w
-- , bu
-- & buPos .~ hp +.+ normalizeV (_buPos bu -.- hp)
-- & buVel %~ reflectIn dir
-- )
DestroyBullet -> expireAndDamage bu hitstream w DestroyBullet -> expireAndDamage bu hitstream w
where where
ep = sp +.+ _buVel bu
sp = _buPos bu sp = _buPos bu
hitstream = thingsHit sp ep w hitstream = thingsHit sp (sp + _buVel bu) w
setFromToDams :: Bullet -> Point2 -> [Damage] setFromToDams :: Bullet -> Point2 -> [Damage]
setFromToDams bu p = map f (_buDamages bu) setFromToDams bu p = map f (_buDamages bu)