Game feel checklist for Godot 4 (hit stop, trauma shake, coyote time and more)

I make these tools; code and text are AI-assisted and tested by me.

This is a short tutorial-style list of the ten changes I find give the most improvement per line of code. Everything is GDScript for Godot 4.x. The full checklist with 24 items is here: Game feel checklist for Godot 4: 24 small fixes - Hitfeel Kit - Hit Stop, Screen Shake & Damage Numbers for Godot 4 by inkharbor

1. Hit stop. Slow time briefly instead of pausing. The last argument of create_timer makes it ignore time scale, which is what you need here.

func hit_stop(duration := 0.06, slow := 0.05) -> void:
	Engine.time_scale = slow
	await get_tree().create_timer(duration, true, false, true).timeout
	Engine.time_scale = 1.0

2. Screen shake with trauma. Keep a trauma value between 0 and 1, add to it on events, decay it every frame, and offset the Camera2D by noise multiplied by trauma * trauma. The squaring makes small values subtle and large values violent.

3. Hit flash. A canvas_item shader with a flash uniform:

shader_type canvas_item;
uniform float flash : hint_range(0.0, 1.0) = 0.0;
void fragment() {
	vec4 c = texture(TEXTURE, UV);
	COLOR = vec4(mix(c.rgb, vec3(1.0), flash), c.a);
}

Tween it with tween_property(mat, "shader_parameter/flash", 0.0, 0.12).

4. Coyote time. Reset a timer to about 0.1 while is_on_floor() is true and count it down otherwise. A jump is allowed while it is above zero.

5. Input buffering. Save Time.get_ticks_msec() when jump is pressed, and treat the press as valid for about 120 ms. Fire the jump when the character lands inside that window.

6. Squash and stretch. Set the sprite scale to Vector2(1.3, 0.7) on landing and tween it back to Vector2.ONE with TRANS_ELASTIC and EASE_OUT. Scale the sprite, not the collision shape.

7. Camera smoothing and look-ahead. Enable position_smoothing_enabled on Camera2D. For look-ahead, blend offset.x toward the movement direction with 1.0 - exp(-4.0 * delta) so it behaves the same at any frame rate.

8. Easing. Replace linear tweens with set_trans() and set_ease(). Ease-out for things entering, ease-in for things leaving, TRANS_BACK for small overshoots on UI.

9. Sound pitch variation. player.pitch_scale = randf_range(0.92, 1.08) before each play(). Cheap and it removes the repetition.

10. Screen transitions. Tween a full-screen ColorRect alpha to 1, call change_scene_to_file(), then tween back. Put it in an autoload so it survives the scene change.

Tune each value in play, keep them as @export variables, and add one effect at a time so you can tell what helped. Questions and corrections are welcome. I am happy to fix anything that does not work on a particular 4.x version.

We bundled our Godot 4 packs: Godot Juice and Polish Bundle, 13 tools, $54.56 until Oct 16: Godot Juice and Polish Bundle by inkharbor - itch.io