Tweak slime wall collisions, all creatures cliff collisions (min 10)

This commit is contained in:
2026-05-02 19:46:12 +01:00
parent b7aea0eb1f
commit b827827951
6 changed files with 29 additions and 12 deletions
+4 -6
View File
@@ -30,7 +30,8 @@ colCrWall w c = cornpush . wallpush $ pushthrough c
cornpush = crPos . _xy %~ pushOutFromCorners r ls'
wallpush = pushCr (w ^. cWorld . lWorld) wls
pushthrough = crPos . _xy %~ fst . flip (collidePoint p1) wls -- check push throughs
r = crRad (c ^. crType) + wallBuffer
r | SlimeCrit {} <- c ^. crType = min 10 . crRad $ c ^. crType
| otherwise = crRad $ c ^. crType
p1 = c ^. crOldPos . _xy
p2 = c ^. crPos . _xy
ls = _wlLine <$> IM.elems wls
@@ -60,7 +61,8 @@ pushCr w wls cr
ap = cr ^. crOldPos . _xy
-- sp = cr ^. crPos . _xy
ecr = foldl' f (cr & crWallTouch .~ mempty) wls
r = crRad (cr ^. crType)
r | SlimeCrit {} <- cr ^. crType = min 10 . crRad $ cr ^. crType
| otherwise = crRad $ cr ^. crType
f acr wl = case pushOutFromWall' r (acr ^. crPos . _xy) (wl ^. wlLine) of
Just (p,hitp) -> acr & crPos . _xy .~ p & crWallTouch . at (wl ^. wlID) ?~ hitp
Nothing -> acr
@@ -95,10 +97,6 @@ wlWlCrush' w p w1 w2 = (t w1 w2 || t w2 w1) -- test either wall is moving toward
(wallMovement w p x - wallMovement w p y) > 0
f = normalizeV . uncurry (-) . (^. wlLine)
-- the amount to push creatures out from walls, extra to their radius
wallBuffer :: Float
wallBuffer = 0
---- assumes that the wall is orientated
---- assumes wall points are different
--pushOutFromWall :: Float -> Point2 -> (Point2, Point2) -> Maybe Point2