Commit before maybe changing bullets to be in 3d space
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
7114951007332849727
|
||||
5641590692396144028
|
||||
+4
-4
@@ -21,10 +21,10 @@ import Linear
|
||||
|
||||
updateBullet :: World -> Bullet -> (World, Maybe Bullet)
|
||||
updateBullet w bu
|
||||
| magV (_buVel bu) < 10
|
||||
| norm (_buVel bu) < 10
|
||||
, BulBall _ <- _buPayload bu =
|
||||
(useBulletPayload bu (_buPos bu) w, Nothing)
|
||||
| magV (_buVel bu) < 1 = (useBulletPayload bu (_buPos bu) w, Nothing)
|
||||
| norm (_buVel bu) < 1 = (useBulletPayload bu (_buPos bu) w, Nothing)
|
||||
-- have to be slightly carefull not to accelerate bullets using magnets
|
||||
| otherwise = second (Just . updateBulVel) . hitEffFromBul w $ applyMagnetsToBul bu w
|
||||
|
||||
@@ -52,7 +52,7 @@ doMagnetBuBu bu mg
|
||||
mgalignpos
|
||||
| dotV bvel (bpos - mpos) > 0 = bpos - mpos
|
||||
| otherwise = mpos - bpos
|
||||
d = dist (bu ^. buPos) (mg ^. mgPos)
|
||||
d = distance (bu ^. buPos) (mg ^. mgPos)
|
||||
|
||||
updateBulVel :: Bullet -> Bullet
|
||||
updateBulVel bt = bt & buVel .*.*~ _buDrag bt
|
||||
@@ -145,7 +145,7 @@ makeFragBullets p w = w & cWorld . lWorld . bullets .++~ bus
|
||||
makeFlak :: Bullet -> Point2 -> World -> World
|
||||
makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
|
||||
where
|
||||
s = min 10 (0.5 * magV (_buVel bu))
|
||||
s = min 10 (0.5 * norm (_buVel bu))
|
||||
xs = take 5 $ randomRs (- s, s) $ _randGen w
|
||||
f x =
|
||||
bu & buVel %~ g x
|
||||
|
||||
Reference in New Issue
Block a user