Refactor gun smoke
This commit is contained in:
@@ -414,7 +414,7 @@ hvAutoGun = defaultAutoGun
|
||||
, _wpFireRate = 25
|
||||
, _wpFireState = 0
|
||||
, _wpFire = rateIncAB 24 10 (torqueBeforeForced 0.1 mkHvBul)
|
||||
$torqueAfter 0.2 mkHvBul
|
||||
$ torqueAfter 0.2 mkHvBul
|
||||
, _wpSpread = autogunSpread
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||
@@ -789,7 +789,7 @@ moveShell time i cid rot accel w
|
||||
$ (normalizeAnglePi (dir - _crDir cr)) / 20
|
||||
_ -> 0
|
||||
r1 = _randGen w & evalState (randInCirc 10)
|
||||
smokeGen = makeSmokeCloud (oldPos +.+ r1 +.+ 30 *.* (normalizeV (oldPos -.- newPos)))
|
||||
smokeGen = makeSmokeCloudAt (oldPos +.+ r1 +.+ 30 *.* (normalizeV (oldPos -.- newPos)))
|
||||
|
||||
|
||||
normalizeAnglePi angle | normalizeAngle angle > pi = normalizeAngle angle - 2*pi
|
||||
@@ -951,7 +951,7 @@ moveFlame rotd w pt
|
||||
(0.2 *.* vel)
|
||||
scaleChange | time < 80 = 3
|
||||
| otherwise = 3 - (fromIntegral time - 80) * 0.2
|
||||
smokeGen = makeFlamerSmoke ep
|
||||
smokeGen = makeFlamerSmokeAt ep
|
||||
|
||||
|
||||
flamerAngle = 0.3
|
||||
@@ -1439,7 +1439,7 @@ moveRemoteShell time i cid itid dir w
|
||||
thingHit = hitCr <|> hitWl
|
||||
|
||||
r1 = _randGen w & evalState (randInCirc 10)
|
||||
smokeGen = makeSmokeCloud (oldPos +.+ r1 +.+ 30 *.* (normalizeV (oldPos -.- newPos)))
|
||||
smokeGen = makeSmokeCloudAt (oldPos +.+ r1 +.+ 30 *.* (normalizeV (oldPos -.- newPos)))
|
||||
doExplosion = explodeRemoteRocket itid i cid
|
||||
setScope w' = case _itemPositions w' IM.! itid of
|
||||
InInv cid invid
|
||||
|
||||
@@ -24,47 +24,24 @@ makeCloudAt rad t drawFunc p w
|
||||
, _clEffect = const id
|
||||
}
|
||||
|
||||
fadeOutTime :: Color -> Float -> Cloud -> Picture
|
||||
fadeOutTime col fadet cl = setLayer 2
|
||||
drawCloudWith :: Float -> Float -> Color -> Cloud -> Picture
|
||||
drawCloudWith radMult fadet col cl = setLayer 2
|
||||
. setDepth (-0.5)
|
||||
. color (withAlpha a col)
|
||||
$ circleSolid (4 * _clRad cl)
|
||||
$ circleSolid (radMult * _clRad cl)
|
||||
where a = min 1 $ fromIntegral (_clTimer cl) / fadet
|
||||
|
||||
|
||||
makeThickSmokeAt :: Point2 -> World -> World
|
||||
makeThickSmokeAt = makeCloudAt 2 50 (fadeOutTime black 50)
|
||||
makeThickSmokeAt = makeCloudAt 3 50 (drawCloudWith 4 50 black)
|
||||
|
||||
makeThinSmokeAt :: Point2 -> World -> World
|
||||
makeThinSmokeAt = makeSmokeCloud
|
||||
makeThinSmokeAt = makeCloudAt 5 400 (drawCloudWith 4 400 (withAlpha 0.05 black))
|
||||
|
||||
makeSmokeCloud :: Point2 -> World -> World
|
||||
makeSmokeCloud pos w = w & clouds %~ IM.insert i theCloud
|
||||
where i = newKey $ _clouds w
|
||||
theCloud = Cloud { _clID = i
|
||||
, _clPos = pos
|
||||
, _clVel = (0,0)
|
||||
, _clPict = fadeOutPict (-0.5)
|
||||
, _clRad = 5
|
||||
, _clTimer = 200
|
||||
, _clEffect = const id
|
||||
}
|
||||
makeSmokeCloudAt :: Point2 -> World -> World
|
||||
makeSmokeCloudAt = makeCloudAt 5 200 (drawCloudWith 4 200 (greyN 0.5))
|
||||
|
||||
fadeOutPict :: Float -> Cloud -> Picture
|
||||
fadeOutPict dpth cl = setLayer 2 . setDepth dpth . color (withAlpha a $ greyN 0.5) $ circleSolid (4 * _clRad cl)
|
||||
where a = fromIntegral (_clTimer cl) / 200
|
||||
|
||||
makeFlamerSmoke :: Point2 -> World -> World
|
||||
makeFlamerSmoke pos w = w & clouds %~ IM.insert i theCloud
|
||||
where i = newKey $ _clouds w
|
||||
theCloud = Cloud { _clID = i
|
||||
, _clPos = pos
|
||||
, _clVel = (0,0)
|
||||
, _clPict = fadeOutPict 0
|
||||
, _clRad = 5
|
||||
, _clTimer = 200
|
||||
, _clEffect = const id
|
||||
}
|
||||
makeFlamerSmokeAt :: Point2 -> World -> World
|
||||
makeFlamerSmokeAt = makeCloudAt 3 200 (drawCloudWith 4 200 (greyN 0.5))
|
||||
|
||||
spawnSmokeAtCursor :: World -> World
|
||||
spawnSmokeAtCursor w = makeSmokeCloud (mouseWorldPos w) w
|
||||
spawnSmokeAtCursor w = makeSmokeCloudAt (mouseWorldPos w) w
|
||||
|
||||
Reference in New Issue
Block a user