Create a slow motion effect with only a few lines of code

Do you have a really useful utility function? An quick way of doing something tedius? Perhaps you know how to avoid a common problem. Please share!

I like these functions which can be used to create a slow motion effect:

# This will make the game play at half-speed by default.
func start_slow_motion(scale: float = 0.5) -> void:
	Engine.time_scale = scale
	AudioServer.playback_speed_scale = scale

# Run the game at normal speed.
func stop_slow_motion() -> void:
	Engine.time_scale = 1.0
	AudioServer.playback_speed_scale = 1.0
16 Likes

I’ve used the time_scale quite a lot, but I never thought about changing the audio speed too. I’ll definitely keep this in mind for next time :grin:

2 Likes

Bonus points if you use tweens instead of changing it suddenly!:wink:

6 Likes

It’s a nice trick. I recorded a video about it.

I’ve opened a PR to better document AudioServer.playback_speed_scale: Document `AudioServer.playback_speed_scale` in `Engine.time_scale` by Calinou · Pull Request #86071 · godotengine/godot · GitHub

2 Likes