mirror of
https://github.com/tsoding/boomer
synced 2024-11-16 12:12:47 +00:00
(#54) make radius deceleration depend on delta radius
This commit is contained in:
parent
eea38a2247
commit
76e9b7dfca
@ -84,12 +84,13 @@ type Flashlight = object
|
||||
|
||||
const
|
||||
INITIAL_FL_DELTA_RADIUS = 100.0
|
||||
FL_DELTA_RADIUS_DECELERATION = 400.0
|
||||
FL_DELTA_RADIUS_DECELERATION = 5.0
|
||||
|
||||
proc update(flashlight: var Flashlight, dt: float32) =
|
||||
flashlight.radius = max(0.0, flashlight.radius + flashlight.deltaRadius * dt)
|
||||
|
||||
if abs(flashlight.deltaRadius) > 0.5:
|
||||
flashlight.deltaRadius -= sgn(flashlight.deltaRadius).float32 * FL_DELTA_RADIUS_DECELERATION * dt
|
||||
flashlight.deltaRadius -= flashlight.deltaRadius * FL_DELTA_RADIUS_DECELERATION * dt
|
||||
|
||||
if flashlight.isEnabled:
|
||||
flashlight.shadow = min(flashlight.shadow + 6.0 * dt, 0.8)
|
||||
|
Loading…
Reference in New Issue
Block a user