diff --git a/src/boomer.nim b/src/boomer.nim index bf5a038..8fd9484 100644 --- a/src/boomer.nim +++ b/src/boomer.nim @@ -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)