How to add game juice and hit effects with sprite-sheet VFX in Godot 4
Pack for this guide: Crisp Juice (free sampler on itch.io).
Short answer: Slice the effect's sprite sheet into a SpriteFrames resource (one AtlasTexture per cell), play it on an AnimatedSprite2D at the sheet's frame rate with looping off, and free or recycle the node when animation_finished fires. For effects that fire often, keep a small pool of sprites instead of creating new ones. Add screen shake by moving Camera2D.offset by a decaying amount, and a hit stop by lowering Engine.time_scale for a few hundredths of a second.
1. Read the sprite sheet
"Juice" is the extra feedback that makes an action feel good: a burst where the hit lands, a small shake, a tiny freeze and a sound, all within a fraction of a second. Sprite-sheet effects are the cheapest way to get the burst: frames drawn in a grid, read left to right and top to bottom.
To play one you need four numbers: the cell size, the number of frames, the frame rate and whether it loops. The Crisp Juice free sampler lists them for every sheet in sheets.json. For example gem_burst_blue.png has 192 px cells in an 8 x 3 grid, 20 frames, drawn for 30 fps, and plays once.
2. Turn the sheet into SpriteFrames
sheet_frames.gd
class_name SheetFrames
## Builds a SpriteFrames resource from a grid sprite sheet.
@warning_ignore("integer_division")
static func from_sheet(sheet: Texture2D, cell: int, count: int, fps := 30.0, loop := false) -> SpriteFrames:
var frames := SpriteFrames.new() # comes with an empty "default" animation
frames.set_animation_speed(&"default", fps)
frames.set_animation_loop(&"default", loop)
var cols := sheet.get_width() / cell
for i in count:
var tex := AtlasTexture.new()
tex.atlas = sheet
tex.region = Rect2((i % cols) * cell, (i / cols) * cell, cell, cell)
frames.add_frame(&"default", tex)
return frames
You can do the same in the editor: select an AnimatedSprite2D, create a new SpriteFrames, and in the SpriteFrames panel use Add frames from sprite sheet with the grid size. Code is quicker when you have many sheets.
3. Play a one-shot effect
spawn_once.gd
extends Node2D
## The simplest one-shot: a new AnimatedSprite2D that frees itself when the last frame has shown.
var burst_frames := SheetFrames.from_sheet(preload("res://vfx/gem_burst_blue.png"), 192, 20)
func spawn_burst(where: Vector2) -> AnimatedSprite2D:
var fx := AnimatedSprite2D.new()
fx.sprite_frames = burst_frames
add_child(fx)
fx.global_position = where
fx.animation_finished.connect(fx.queue_free)
fx.play()
return fx
animation_finished only fires when looping is off, which from_sheet() does by default. Looping effects (sparkles, auras, rays) keep playing until you remove them.
4. Pool effects that fire often
vfx_pool.gd
class_name VfxPool
extends Node2D
## A pool of one-shot effects from one sprite sheet: made once, reused forever.
@export var sheet: Texture2D
@export var cell := 192
@export var frame_count := 20
@export var size := 12
@export var additive := false
var _idle: Array[AnimatedSprite2D] = []
var _busy: Array[AnimatedSprite2D] = []
func _ready() -> void:
var frames := SheetFrames.from_sheet(sheet, cell, frame_count)
var mat: CanvasItemMaterial = null
if additive:
mat = CanvasItemMaterial.new()
mat.blend_mode = CanvasItemMaterial.BLEND_MODE_ADD
for i in size:
var fx := AnimatedSprite2D.new()
fx.sprite_frames = frames
fx.material = mat
fx.visible = false
fx.animation_finished.connect(_release.bind(fx))
add_child(fx)
_idle.append(fx)
## Plays one effect at a global position. When all are busy, the oldest restarts.
func play_at(where: Vector2, scale_by := 1.0) -> void:
var fx: AnimatedSprite2D = _idle.pop_back() if not _idle.is_empty() else _busy.pop_front()
_busy.append(fx)
fx.global_position = where
fx.scale = Vector2.ONE * scale_by
fx.rotation = randf() * TAU # round bursts repeat less when turned
fx.visible = true
fx.stop() # back to frame 0
fx.play(&"default")
func _release(fx: AnimatedSprite2D) -> void:
fx.visible = false
_busy.erase(fx)
_idle.append(fx)
stop()resets the animation to frame 0 beforeplay(), so a reused sprite always starts from the beginning.- A random rotation makes round bursts repeat less obviously.
additiveuses aCanvasItemMaterialwithBLEND_MODE_ADD: glows and sparkles look brighter on dark backgrounds.- Twelve sprites is plenty for most games; if the oldest restarting is visible, raise
size.
5. Add screen shake and hit stop
shake_camera.gd
class_name ShakeCamera
extends Camera2D
## Screen shake that fades out by itself. Call add_trauma(0.3) on a hit.
@export var max_offset := Vector2(14, 10)
@export var decay := 2.0 # trauma lost per second
var trauma := 0.0
func add_trauma(amount: float) -> void:
trauma = minf(trauma + amount, 1.0)
func _process(delta: float) -> void:
trauma = maxf(trauma - decay * delta, 0.0)
var strength := trauma * trauma # squared: small hits stay subtle
offset = Vector2(randf_range(-1.0, 1.0), randf_range(-1.0, 1.0)) * max_offset * strength
## Freezes the game for a moment so a big hit lands.
func hit_stop(seconds := 0.06) -> void:
Engine.time_scale = 0.05
await get_tree().create_timer(seconds, true, false, true).timeout
Engine.time_scale = 1.0
Squaring the trauma keeps small hits subtle and big ones strong. For the hit stop, create_timer()'s fourth argument (ignore_time_scale) makes the timer count real time while the game runs at 5% speed.
6. Put it together
hit_demo.gd (children: GemBursts with vfx_pool.gd, Camera with shake_camera.gd)
extends Node2D
@onready var bursts: VfxPool = $GemBursts
@onready var camera: ShakeCamera = $Camera
func on_hit(where: Vector2, critical: bool) -> void:
bursts.play_at(where, 1.5 if critical else 1.0)
camera.add_trauma(0.45 if critical else 0.2)
if critical:
camera.hit_stop(0.06)
Play a sound in the same function (see adding sound effects in Godot 4) and keep the effect on a z_index above your sprites. Use each sheet's own frame rate: effects drawn for 30 fps look rushed at 60.
How this was tested
Run headless in Godot 4.7.2 with gem_burst_blue.png from the Crisp Juice free sampler: the 20 frames and their regions were checked, a one-shot freed itself when it finished, a pool of 3 recycled its oldest effect and got every sprite back, the shake decayed to zero, and the hit stop lasted its 0.1 s in real time.
Free assets to try
Crisp Juice Free: 12 effects (gem burst, match pop, star and coin bursts, looping sunburst rays, confetti, shockwave ring, tap ripple, looping sparkle, a GREAT! text pop, fire burst and a heart emote) as transparent PNG sheets with sheets.json and a Godot 4 project where each effect is a ready-made scene: CrispVfx.spawn(preload("res://addons/crisp_vfx/scenes/Gems/gem_burst_blue.tscn"), self, position) plays one and removes it when it ends. Download Crisp Juice Free. A Godot add-on with 8 of the sampler effects is on GitHub: crisp-juice-free. Preview the sheets in the VFX sprite sheet player.
The full Crisp Juice ($6.99) has 149 effects: gems, rewards, celebration, impacts, magic, highlights, text pops, elements, auras, emotes, trails and cozy effects, each with a Godot 4 scene. Claude (an AI assistant) designed everything in this pack: every frame is drawn by code. All 19 Crisp packs are also in the Crisp Everything Bundle for $17.99.