diff --git a/src/Dodge/Bullet.hs b/src/Dodge/Bullet.hs index 61e86f879..8e73fdada 100644 --- a/src/Dodge/Bullet.hs +++ b/src/Dodge/Bullet.hs @@ -138,13 +138,10 @@ makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs] where s = min 10 (0.5 * magV (_buVel bu)) xs = take 5 $ randomRs (- s, s) $ _randGen w - f x = - bu & buVel %~ g x - -- & buTimer .~ 97 + f x = bu & buVel %~ g x & buPayload .~ BulSpark & buWidth .~ 0.5 - & buDamages - .~ [Damage PIERCING 25 0 0 0 $ PushBackDamage 2] + & buDamages .~ [Damage PIERCING 25 0 0 0 $ PushBackDamage 2] g x v = v +.+ x *.* normalizeV (vNormal v) hitEffFromBul :: World -> Bullet -> (World, Bullet) @@ -156,24 +153,13 @@ hitEffFromBul w bu = case _buEffect bu of return ( w , bu - & buPos .~ hp +.+ normalizeV (_buPos bu -.- hp) + & buPos .~ hp + normalizeV (_buPos bu - hp) & 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 where - ep = sp +.+ _buVel bu sp = _buPos bu - hitstream = thingsHit sp ep w + hitstream = thingsHit sp (sp + _buVel bu) w setFromToDams :: Bullet -> Point2 -> [Damage] setFromToDams bu p = map f (_buDamages bu)