Allow grenades to stick to creatures

This commit is contained in:
2025-01-01 17:44:00 +00:00
parent e8fe4c2d72
commit 511e765e3a
6 changed files with 178 additions and 163 deletions
+13 -7
View File
@@ -112,11 +112,13 @@ drawCircCollisionTest :: World -> Picture
drawCircCollisionTest w = concat $ do
a <- w ^. input . heldWorldPos . at ButtonLeft
b <- w ^. input . heldWorldPos . at ButtonRight
let col | anythingHitCirc 2 a b w = red
let col
| anythingHitCirc 2 a b w = red
| otherwise = green
return $
setLayer DebugLayer (color col $ line [a, b])
<> drawCoord a w <> drawCoord b w
<> drawCoord a w
<> drawCoord b w
drawWallsNearSegment :: World -> Picture
drawWallsNearSegment w = concat $ do
@@ -124,8 +126,10 @@ drawWallsNearSegment w = concat $ do
b <- w ^. input . heldWorldPos . at ButtonRight
return . foldMap f $ wlsNearSeg a b w
where
f wl = setLayer DebugLayer (color rose $ thickLine 3 [a, b])
<> drawCoord a w <> drawCoord b w
f wl =
setLayer DebugLayer (color rose $ thickLine 3 [a, b])
<> drawCoord a w
<> drawCoord b w
where
(a, b) = _wlLine wl
@@ -213,8 +217,10 @@ drawWallsNearCursor :: World -> Picture
drawWallsNearCursor w =
foldMap f $ wlsNearPoint (mouseWorldPos (_input w) (_wCam w)) w
where
f wl = setLayer DebugLayer (color rose $ thickLine 3 [a, b])
<> drawCoord a w <> drawCoord b w
f wl =
setLayer DebugLayer (color rose $ thickLine 3 [a, b])
<> drawCoord a w
<> drawCoord b w
where
(a, b) = _wlLine wl
@@ -351,7 +357,7 @@ drawMousePosition w =
mwp = mouseWorldPos (w ^. input) (w ^. wCam)
drawCoord :: Point2 -> World -> Picture
drawCoord p w =
drawCoord p w =
setLayer FixedCoordLayer
. uncurryV translate (worldPosToScreen (w ^. wCam) p)
. scale 0.1 0.1