Juicebox Pro API — Component Reference.
JuiceCamera2D
extends Camera2D icon_camera.pngTrauma-driven Perlin Shake
Cubic Shake Intensity:
Calculates shake using pow(trauma, 3). This ensures that the shake feels extremely intense at high trauma but decays rapidly to a subtle jitter, preventing "floaty" movement.
Stress Scaling:
As trauma increases, the noise oscillation speed scales via noise_speed + (trauma * stress_scalar * 10.0). High-stress impacts jitter faster than low-stress vibrations.
Camera Recovery:
When trauma reaches zero, the camera utilizes lerp(Vector2.ZERO, delta * 10.0) to ensure the offset and rotation return to a clean neutral state without snapping.
rotation = max_roll * amount * noise.get_noise_1d(time)
offset.x = max_offset.x * amount * noise.get_noise_1d(time + 100)
offset.y = max_offset.y * amount * noise.get_noise_1d(time + 200)
Shake Settings
Noise Settings
Methods
ShakeProfile
Enables rapid iteration by defining shake characteristics as external resources. This allows sound designers or gameplay tuners to modify impacts without editing the Camera node directly.
SquashStretch
extends NodeProcedural deformation for Sprite-based entities targeting the Parent node's scale.
Elasticity Logic:
The component handles the return to the default state automatically in _process. It uses a high-performance linear interpolation to "snap" back to Vector2.ONE.
State Manipulation:
• trigger_jump(): Instantly applies a vertical stretch (jump_scale). Best called when the character's upward velocity is initialized.
• trigger_land(): Instantly applies a horizontal squash (land_scale). Best called upon ground collision.
Exports
Editor Tools
func _process(delta):
parent.scale = parent.scale.lerp(
Vector2.ONE,
elasticity * delta
)
Utilizes Engine.is_editor_hint() to allow scale previewing directly in the Godot viewport via the Inspector booleans.
JuiceAnimator
extends NodeA modular animation switcher for Sprite2D nodes that avoids AnimationPlayer overhead for simple frame-cycling.
State Reset Logic:
Calling play() resets the _frame_timer and sets the parent's texture and frame layout instantly. It specifically sets vframes = 1, assuming a horizontal sheet.
One-Shot Handling:
If a JuiceAnimation has loop = false, playback stops on the final frame and sets _is_playing = false.
$JuiceAnimator.current_animation = "attack"
Playback API
JuiceAnimation
Utility Modules
ImpactFrame
Hitstop Implementation Logic
Triggers a temporary freeze by manipulating Engine.time_scale. Since global time is frozen, the internal timer requires specific configuration to escape the await loop.
GhostTrail
Snapshot Trail Logic
Spawns independent sprite clones to create a high-speed after-image effect. Clones are added to get_tree().root to decouple them from the parent's transformation matrix.
PopLabelManager
Floating Combat Text System
A high-performance system for spawning floating labels. Uses set_parallel(true) to handle simultaneous motion and aesthetic transforms.
- Y-Displacement: Moves to
pos + drift_velocityusingTRANS_BOUNCE. - X-Jitter: Random horizontal drift of
±20pxto prevent label overlap. - Automatic GC: Lifecycle managed via
tween.chain().tween_callback(queue_free).