This commit is contained in:
2022-06-26 01:54:00 +01:00
parent ac9181e1a1
commit 7532c4cafb
2 changed files with 18 additions and 11 deletions
+6 -2
View File
@@ -52,7 +52,10 @@ moveGrenade pj w
| _pjTimer pj <= 0 = w
& props %~ IM.delete pID
& _pjPayload pj (_prPos (_props w IM.! pID))
| otherwise = case collideCircWallsList oldPos newPos 4 $ wallsNearPoint' newPos w of
-- this should maybe
-- be wallsAlongLine
-- or something vvv
| otherwise = case reflectCircWallsDamp 1 oldPos newPos 4 $ wallsNearPoint newPos w of
Nothing -> w & props . ix pID %~ normalUpdate
Just (p,v) -> w
& soundStart (Tap 0) p tapQuietS Nothing
@@ -159,6 +162,7 @@ throwArmReset x = ItInvEffect {_ieInv = f ,_ieCounter = x }
-- _ -> w'
-- pos = fromMaybe (V2 0 0) $ w ^? props . ix pjid . pjPos
-- TODO hive out movement and share with moveGrenade
moveRemoteBomb :: Int -> Int -> Int -> World -> World
moveRemoteBomb itid time pID w
| time < -4 = updatePicture
@@ -182,7 +186,7 @@ moveRemoteBomb itid time pID w
-- this is hacky, should use a version of collidePointWalls' that collides
-- circles and walls
invShift x = x -.- 5 *.* normalizeV (_pjVel pj)
hitWl = collideCircWallsList oldPos newPos 4 $ wallsNearPoint' newPos w
hitWl = reflectCircWallsDamp 1 oldPos newPos 4 $ wallsNearPoint newPos w
finalPos = maybe newPos (invShift . fst) hitWl
setV v = set (props . ix pID . pjVel) v
updateV = maybe id (setV . snd) hitWl