Tweak cloud springs
This commit is contained in:
@@ -359,6 +359,7 @@ startCr = basicCreature
|
|||||||
,miniGun
|
,miniGun
|
||||||
,medkit 50
|
,medkit 50
|
||||||
,bezierGun
|
,bezierGun
|
||||||
|
,poisonSprayer
|
||||||
]
|
]
|
||||||
++ repeat NoItem))
|
++ repeat NoItem))
|
||||||
-- startInv
|
-- startInv
|
||||||
|
|||||||
@@ -839,7 +839,7 @@ aGasCloud cid w
|
|||||||
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
pos = _crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
||||||
pos2 = (0.5 *.* vel) +.+
|
pos2 = (0.5 *.* vel) +.+
|
||||||
_crPos cr +.+ ((_crRad cr + 2.9) *.* unitVectorAtAngle (_crDir cr))
|
_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)
|
insertCloud = makeGasCloud pos vel -- . makeFlame pos2 vel (Just cid)
|
||||||
|
|
||||||
makeGasCloud :: Point2 -> Point2 -> World -> World
|
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)
|
, _clPict = \_ -> onLayer CrLayer $ color (withAlpha 0.1 col)
|
||||||
$ circleSolid 20
|
$ circleSolid 20
|
||||||
, _clRad = 20
|
, _clRad = 20
|
||||||
, _clTimer = 200
|
, _clTimer = 400
|
||||||
, _clEffect = cloudPoisonDamage
|
, _clEffect = cloudPoisonDamage
|
||||||
}
|
}
|
||||||
(col, g) = runState (takeOne [green,yellow]) $ _randGen w
|
(col, g) = runState (takeOne [green,yellow]) $ _randGen w
|
||||||
|
|||||||
+4
-2
@@ -130,7 +130,7 @@ updateCloud c w | _clTimer c < 1 = w & clouds %~ IM.delete (_clID c)
|
|||||||
|
|
||||||
moveCloud :: Cloud -> World -> World
|
moveCloud :: Cloud -> World -> World
|
||||||
moveCloud c w = _clEffect c c . theUpdate $ w
|
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)
|
springVels = IM.foldr' (clClSpringVel c w) (_clVel c) (cloudsNearPoint oldPos w)
|
||||||
oldPos = _clPos c
|
oldPos = _clPos c
|
||||||
newPos = oldPos +.+ newVel
|
newPos = oldPos +.+ newVel
|
||||||
@@ -144,12 +144,14 @@ moveCloud c w = _clEffect c c . theUpdate $ w
|
|||||||
clClSpringVel :: Cloud -> World -> Cloud -> Point2 -> Point2
|
clClSpringVel :: Cloud -> World -> Cloud -> Point2 -> Point2
|
||||||
clClSpringVel a w b v
|
clClSpringVel a w b v
|
||||||
| ida == idb = 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
|
| otherwise = v
|
||||||
where ida = _clID a
|
where ida = _clID a
|
||||||
idb = _clID b
|
idb = _clID b
|
||||||
pa = _clPos a
|
pa = _clPos a
|
||||||
pb = _clPos b
|
pb = _clPos b
|
||||||
|
radDist = (_clRad a + _clRad b) / 2
|
||||||
|
|
||||||
simpleCrSprings :: World -> World
|
simpleCrSprings :: World -> World
|
||||||
simpleCrSprings w = IM.foldr' crSpring w $ _creatures w
|
simpleCrSprings w = IM.foldr' crSpring w $ _creatures w
|
||||||
|
|||||||
Reference in New Issue
Block a user