Tweak cloud springs

This commit is contained in:
jgk
2021-03-23 23:49:59 +01:00
parent 3f86b0cda0
commit b7ec173d0e
3 changed files with 7 additions and 4 deletions
+1
View File
@@ -359,6 +359,7 @@ startCr = basicCreature
,miniGun
,medkit 50
,bezierGun
,poisonSprayer
]
++ repeat NoItem))
-- startInv
+2 -2
View File
@@ -839,7 +839,7 @@ aGasCloud cid w
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
pos2 = (0.5 *.* vel) +.+
_crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
vel = (_crPos cr -.- _crOldPos cr) +.+ 4 *.* unitVectorAtAngle dir
vel = (_crPos cr -.- _crOldPos cr) +.+ 10 *.* unitVectorAtAngle dir
insertCloud = makeGasCloud pos vel -- . makeFlame pos2 vel (Just cid)
makeGasCloud :: Point2 -> Point2 -> World -> World
@@ -852,7 +852,7 @@ makeGasCloud pos vel w = over clouds (IM.insert i theCloud)
, _clPict = \_ -> onLayer CrLayer $ color (withAlpha 0.1 col)
$ circleSolid 20
, _clRad = 20
, _clTimer = 200
, _clTimer = 400
, _clEffect = cloudPoisonDamage
}
(col, g) = runState (takeOne [green,yellow]) $ _randGen w
+4 -2
View File
@@ -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