Add slime sounds
This commit is contained in:
+9
-3
@@ -1019,9 +1019,10 @@ crCrSpring c1 c2
|
||||
return $ z c1 > h2 || z c2 > h1
|
||||
olap a b = ix (a ^. crID) . crPos . _xy +~ overlap b
|
||||
olap' a b = ix (a ^. crID) . crPos . _xy -~ overlap b
|
||||
suckx = min 1 $ 2 * (1 - distance xy1 xy2 / (r1 + r2))
|
||||
rolap = ix id1 . crPos . _xy +~ (suckx * 1.5 * m2 / (m1+m2)) *^ normalize (xy2 - xy1)
|
||||
rolap' = ix id2 . crPos . _xy +~ (suckx * 1.5*m1 / (m1+m2)) *^ normalize (xy1 - xy2)
|
||||
suckx = (min 1 $ 2 * (1 - distance xy1 xy2 / (r1 + r2))) ^ (2:: Int)
|
||||
rolap = ix id1 . crPos . _xy +~ f (suckx * 1.5 * m2 / (m1+m2)) *^ normalize (xy2 - xy1)
|
||||
rolap' = ix id2 . crPos . _xy +~ f (suckx * 1.5*m1 / (m1+m2)) *^ normalize (xy1 - xy2)
|
||||
f = min (distance xy1 xy2/2)
|
||||
id1 = _crID c1
|
||||
id2 = _crID c2
|
||||
xy1 = c1 ^. crPos . _xy
|
||||
@@ -1039,6 +1040,7 @@ crCrSpring c1 c2
|
||||
fuseSlimes :: Creature -> Creature -> World -> World
|
||||
fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ c)
|
||||
. (cWorld . lWorld . creatures . at maxi .~ Nothing)
|
||||
. dosound
|
||||
where
|
||||
c' | c1 ^?! crType . slimeRad > c2 ^?! crType . slimeRad = c1
|
||||
| otherwise = c2
|
||||
@@ -1053,6 +1055,10 @@ fuseSlimes c1 c2 = (cWorld . lWorld . creatures . ix mini .~ c)
|
||||
r1 = c1 ^?! crType . slimeRad
|
||||
r2 = c2 ^?! crType . slimeRad
|
||||
r = sqrt (r1*r1 + r2*r2)
|
||||
dosound w = w & soundStart (CrSound i1) (c ^. crPos . _xy) s Nothing
|
||||
& randGen .~ g
|
||||
where
|
||||
(s,g) = runState (takeOne [slurp1S,slurp2S,slurp3S,slurp4S,slurp5S]) (w ^. randGen)
|
||||
|
||||
|
||||
updateDelayedEvents :: World -> World
|
||||
|
||||
Reference in New Issue
Block a user