Two Godot 4 scenes running the same sword swing: on top, the slime just plays a sound; below, the hit freezes, flashes, squashes, shakes the camera and throws sparks

Top: a sword hits a slime, a sound plays, and nothing else happens. The slime has the emotional range of a parking meter. Bottom: the same swing, the same timing, and suddenly it hurts. Both run the same Godot 4.3 scene. The difference is about 140 lines of GDScript across four small scripts, and we are going to write all of them.

Five tricks stack up to make a hit feel heavy:

  1. Hitstop: freeze the game for a few frames on impact.
  2. Screen shake: rattle the camera, harder for big hits.
  3. Flash: the target goes white for a split second.
  4. Squash and knockback: the target deforms and slides back.
  5. Layered sound: a sharp hit plus a low thud, never the exact same pitch twice.

Plus sparks and a damage number, because we have standards.

Five frames from one critical hit: swing, freeze and flash, squash and shake, sparks, settle

Every script below ran in Godot 4.3 (Compatibility renderer) before it went into this post. The GIFs and stills are frames from those runs.

1. Sounds: two layers and a little pitch wobble

A single hit sound played over and over turns into a metronome. Two fixes: layer a sharp impact over a low thud so the hit has weight, and nudge the pitch a few percent every time so no two hits are identical.

This uses files from the Cozy RPG Combat SFX pack. Copy its OGG/01-swings-dodges, OGG/02-blade-hits, OGG/04-blunt-axe and OGG/08-crits-combos folders into res://sfx/, keeping the folder names. Any sounds work if you change the paths.

Save this as res://sfx.gd and add it under Project > Project Settings > Globals > Autoload with the name Sfx.

extends Node # Autoload this as "Sfx". Layered hit sounds from the Cozy RPG Combat SFX pack. const DIR := "res://sfx/" const SWINGS := ["01-swings-dodges/sword_swing_light_01", "01-swings-dodges/sword_swing_light_02", "01-swings-dodges/sword_swing_light_03", "01-swings-dodges/sword_swing_light_04", "01-swings-dodges/sword_swing_light_05"] const IMPACTS := ["02-blade-hits/blade_hit_body_01", "02-blade-hits/blade_hit_body_02", "02-blade-hits/blade_hit_body_03", "02-blade-hits/blade_hit_body_04"] const THUDS := ["04-blunt-axe/blunt_hit_01", "04-blunt-axe/blunt_hit_02", "04-blunt-axe/blunt_hit_03", "04-blunt-axe/blunt_hit_04"] const CRITS := ["08-crits-combos/crit_hit_01", "08-crits-combos/crit_hit_02", "08-crits-combos/crit_hit_03"] var _voices: Array[AudioStreamPlayer] = [] var _next := 0 func _ready() -> void: for i in 8: var p := AudioStreamPlayer.new() add_child(p) _voices.append(p) func _play(file: String, volume_db := 0.0, pitch := 1.0) -> void: var p := _voices[_next] _next = (_next + 1) % _voices.size() p.stream = load(DIR + file + ".ogg") p.volume_db = volume_db p.pitch_scale = pitch p.play() func swing() -> void: _play(SWINGS.pick_random(), -6.0, randf_range(0.95, 1.08)) func hit(crit := false) -> void: # Layer 1: the sharp part. Layer 2: a low thud underneath for weight. _play(IMPACTS.pick_random(), -3.0, randf_range(0.92, 1.08)) _play(THUDS.pick_random(), -10.0, randf_range(0.75, 0.85)) if crit: _play(CRITS.pick_random(), -2.0) 

Eight AudioStreamPlayer nodes take turns, so a fast combo never cuts off its own previous hit. The thud plays 7 dB under the impact and pitched down to 75 to 85 percent, so you feel it more than you hear it. On a crit, a third layer comes in on top.

2. Hitstop and screen shake

Save this as res://juice.gd and autoload it as Juice.

extends Node # Autoload this as "Juice". Hitstop and camera shake for any hit. var camera: Camera2D var _shake := 0.0 func hitstop(duration := 0.07) -> void: Engine.time_scale = 0.05 # The last "true" makes the timer count real time, not slowed time. await get_tree().create_timer(duration, true, false, true).timeout Engine.time_scale = 1.0 func shake(amount := 10.0) -> void: _shake = maxf(_shake, amount) func _process(delta: float) -> void: if camera == null: return var real_delta := delta / Engine.time_scale _shake = move_toward(_shake, 0.0, 60.0 * real_delta) camera.offset = Vector2(randf_range(-1, 1), randf_range(-1, 1)) * _shake 

Hitstop drops Engine.time_scale to 5 percent for 0.07 seconds, which was three frames at 30 fps in my test run. That is short enough that nobody consciously sees a freeze, and long enough that the brain registers "that connected." The catch: a normal timer would also slow down to 5 percent and the freeze would last over a second. The fourth argument of create_timer tells it to ignore time scale, which is the whole trick.

Shake keeps one number, the current shake strength, and fades it toward zero every frame. Each frame the camera gets a random offset scaled by that number. Calling shake() again during a shake keeps the bigger value instead of stacking, so ten quick hits do not launch your camera into orbit. Dividing delta by the time scale keeps the shake fading during hitstop, which keeps it snappy.

Tell Juice which camera to shake once, in your level script:

Juice.camera = $Camera2D 

3. The enemy that reacts

Make a Node2D for the enemy with a Polygon2D child named Body, and attach this as enemy.gd. Using a Sprite2D instead? Change Polygon2D to Sprite2D on the body line. Here is the part that runs on every hit:

extends Node2D # enemy.gd: a target that reacts to hits. Needs a child Polygon2D named "Body". @onready var body: Polygon2D = $Body var _home: Vector2 func _ready() -> void: _home = position func take_hit(damage: int, from_dir: Vector2, crit := false) -> void: Sfx.hit(crit) Juice.hitstop(0.12 if crit else 0.07) Juice.shake(22.0 if crit else 10.0) _flash() _squash_and_knockback(from_dir, 1.6 if crit else 1.0) _pop_number(damage, crit) _sparks(from_dir) 

Bigger hits get a longer freeze, more shake and more squash. The rest of the file is four small helpers.

Flash. A modulate color above 1.0 multiplies the art past full brightness, so a green slime turns almost white. It then fades back over 0.12 seconds. Because tweens run on game time, the flash holds during the hitstop freeze, which is exactly when you want people to see it.

func _flash() -> void: body.modulate = Color(4, 4, 4) # overbright reads as white create_tween().tween_property(body, "modulate", Color.WHITE, 0.12) 

Squash and knockback. Stretch wide and short, then spring back with an elastic ease. Shove the whole enemy back along the hit direction and slide it home. If your art has its origin at the feet, the squash looks like the slime got sat on, which is correct.

func _squash_and_knockback(from_dir: Vector2, power: float) -> void: body.scale = Vector2(1.0 + 0.3 * power, 1.0 - 0.25 * power) var t := create_tween().set_parallel() t.tween_property(body, "scale", Vector2.ONE, 0.35) \ .set_trans(Tween.TRANS_ELASTIC).set_ease(Tween.EASE_OUT) position = _home + from_dir * 24.0 * power t.tween_property(self, "position", _home, 0.2).set_ease(Tween.EASE_OUT) 

Damage number. A label with a thick outline that drifts up and fades. Crits get a bigger font, a gold color and an exclamation mark, because a crit should brag.

func _pop_number(damage: int, crit: bool) -> void: var label := Label.new() label.text = str(damage) + ("!" if crit else "") label.add_theme_font_size_override("font_size", 56 if crit else 36) label.add_theme_color_override("font_color", Color("ffd166") if crit else Color.WHITE) label.add_theme_constant_override("outline_size", 10) label.add_theme_color_override("font_outline_color", Color("2b1d3a")) label.position = Vector2(randf_range(-30, 10), -150) add_child(label) var t := create_tween().set_parallel() t.tween_property(label, "position:y", label.position.y - 70, 0.7) \ .set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC) t.tween_property(label, "modulate:a", 0.0, 0.3).set_delay(0.4) t.chain().tween_callback(label.queue_free) 

Sparks. A one-shot CPUParticles2D burst sprayed along the hit direction, falling under gravity, and cleaned up when it finishes.

func _sparks(from_dir: Vector2) -> void: var p := CPUParticles2D.new() p.one_shot = true p.explosiveness = 1.0 p.amount = 24 p.lifetime = 0.5 p.direction = from_dir p.spread = 55.0 p.initial_velocity_min = 220.0 p.initial_velocity_max = 420.0 p.gravity = Vector2(0, 900) p.scale_amount_min = 6.0 p.scale_amount_max = 11.0 p.color = Color("fff3b0") p.position = Vector2(-70, -60) p.finished.connect(p.queue_free) add_child(p) p.emitting = true 

4. Something to swing

For testing, here is a tiny attacker that swings on a timer. It needs a child Node2D named Pivot with your sword under it, and its target set to the enemy in the Inspector. Every fourth swing is a crit.

extends Node2D # player.gd: swings at the target on a timer. Needs a child Node2D named "Pivot". @export var target: Node2D @export var swing_every := 0.9 var _count := 0 func _ready() -> void: $Pivot.rotation = deg_to_rad(-40) while true: await get_tree().create_timer(swing_every).timeout _swing() func _swing() -> void: _count += 1 var crit := _count % 4 == 0 # every fourth swing is a big one var damage := randi_range(30, 45) if crit else randi_range(8, 16) Sfx.swing() var t := create_tween() t.tween_property($Pivot, "rotation", deg_to_rad(100), 0.08) t.tween_callback(target.take_hit.bind(damage, Vector2.RIGHT, crit)) t.tween_property($Pivot, "rotation", deg_to_rad(-40), 0.25) 

In your real game, call take_hit() from wherever your hitbox detects a hit. The enemy does not care who swung.

Same frame, two versions: the plain slime, and the juiced one mid flash with a gold crit number

Tuning notes

  • Long hitstop tends to read as lag instead of weight. Keep normal hits short and save the long freezes for crits and finishing blows.
  • If everything shakes, nothing does. Small shake on normal hits, big shake on crits, none on misses.
  • If your mix gets loud during combos, lower the impact layer before the thud. The thud is what makes it heavy.

Your slime deserves better sounds

The code above is the easy half. The hard half is having enough good sounds that the random picks rarely land on the same file twice and every weapon sounds like itself. That is the Cozy RPG Combat SFX pack: 150 combat sounds in 14 named folders, in both WAV and OGG. Sword swings light and heavy, blade hits on body, armor, wood and shields, blocks and parries, blunt hits and axe chops, bows and crossbows, spear, punch and kick, gear and armor, crits and combos, hurt and defeat, magic for fire, ice, lightning, poison, healing and shields, explosions and loot, and stingers for when the boss finally drops.

Cozy RPG Combat SFX sample: one fight, start to finish, with the file used for every beat

Cozy RPG Combat SFX sample: grouped folders and clean file names

Every file is named by what it is, like blade_hit_body_03, so the arrays in sfx.gd above take a minute to fill in instead of an afternoon of recording a stick hitting a pillow. Grab it here: Cozy RPG Combat SFX