Juicebox Pro API — Component Reference.

JuiceCamera2D

extends Camera2D icon_camera.png

Trauma-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.

# Sampling Logic (Axis Decoupling)
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

max_offsetVector2(8, 6)
max_rollfloat(0.5)
trauma_decayfloat(2.0)

Noise Settings

noise_frequencyfloat(0.2)
noise_speedfloat(8.0)
stress_scalarfloat(1.0)

Methods

add_trauma(amount)
shake(intensity, decay)
apply_profile(profile)
Resource

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.

intensity float
decay float
speed float
stress float

SquashStretch

extends Node

Procedural 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

jump_scaleVector2(0.8, 1.2)
land_scaleVector2(1.3, 0.7)
elasticityfloat(10.0)

Editor Tools

test_jumpbool
test_landbool
EDITOR_HINT
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 Node

A 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.

# Code Trigger Example
$JuiceAnimator.current_animation = "attack"

Playback API

animations Array[JuiceAnimation]
autoplay String("idle")
play(anim_name) void
is_playing_one_shot() bool
Resource

JuiceAnimation

name String texture Texture2D frames int(1) fps float(10.0) loop bool(true)

Utility Modules

ImpactFrame

res://.../impact_frame.gd
play()

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.

freeze_duration 0.05s
time_scale_factor 0.0
flash_screen bool(false)
flash_color Color.WHITE

GhostTrail

res://.../ghost_trail.gd

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.

emit_interval 0.05s
active bool(false)
fade_time 0.4s
color_modulate Color(0.3, 0.6, 1)

PopLabelManager

res://.../pop_label.gd
spawn_text(txt, pos, col)

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_velocity using TRANS_BOUNCE.
  • X-Jitter: Random horizontal drift of ±20px to prevent label overlap.
  • Automatic GC: Lifecycle managed via tween.chain().tween_callback(queue_free).
drift_velocity Vector2(0, -100)
gravity float(200.0)
test_pop bool
font_resource Font