Tweak cloud springs
This commit is contained in:
+4
-2
@@ -130,7 +130,7 @@ updateCloud c w | _clTimer c < 1 = w & clouds %~ IM.delete (_clID c)
|
||||
|
||||
moveCloud :: Cloud -> World -> World
|
||||
moveCloud c w = _clEffect c c . theUpdate $ w
|
||||
where newVel = 0.99 *.* springVels
|
||||
where newVel = 0.95 *.* springVels
|
||||
springVels = IM.foldr' (clClSpringVel c w) (_clVel c) (cloudsNearPoint oldPos w)
|
||||
oldPos = _clPos c
|
||||
newPos = oldPos +.+ newVel
|
||||
@@ -144,12 +144,14 @@ moveCloud c w = _clEffect c c . theUpdate $ w
|
||||
clClSpringVel :: Cloud -> World -> Cloud -> Point2 -> Point2
|
||||
clClSpringVel a w b v
|
||||
| ida == idb = v
|
||||
| dist pa pb < 5 = v +.+ 0.1 *.* (safeNormalizeV (pa -.- pb))
|
||||
| dist pa pb < radDist = v +.+ 0.1 *.* (safeNormalizeV (pa -.- pb))
|
||||
-- | dist pa pb < radDist = v +.+ 0.1 *.* (safeNormalizeV (pa -.- pb))
|
||||
| otherwise = v
|
||||
where ida = _clID a
|
||||
idb = _clID b
|
||||
pa = _clPos a
|
||||
pb = _clPos b
|
||||
radDist = (_clRad a + _clRad b) / 2
|
||||
|
||||
simpleCrSprings :: World -> World
|
||||
simpleCrSprings w = IM.foldr' crSpring w $ _creatures w
|
||||
|
||||
Reference in New Issue
Block a user