Menu
CoddyTech

Process Mode

Part of the Game Rules section of Coddy's Godot journey. Lesson 14 of 29.

A paused game stops every node. Some nodes should keep running, like a blinking Game Over message or a pause menu.

A node's process_mode decides:

  • Node.PROCESS_MODE_INHERIT: do what the parent does. This is the default.
  • Node.PROCESS_MODE_PAUSABLE: stop when the game is paused.
  • Node.PROCESS_MODE_ALWAYS: keep running, paused or not.
$Music.process_mode = Node.PROCESS_MODE_ALWAYS

The script now blinks Game Over with a Timer called Blink. The pause stops that timer, so the message never blinks.

challenge icon

Challenge

Easy

Make Game Over keep blinking while the game is paused. In _ready(), set the Blink timer's process_mode to Node.PROCESS_MODE_ALWAYS.

Try it yourself

extends Node2D

var lives = 3

func _ready():
	$HUD/Lives.text = "Lives: %d" % lives
	$Player.hurt.connect(_on_player_hurt)
	$Blink.timeout.connect(_on_blink_timeout)

func _on_player_hurt():
	lives -= 1
	$HUD/Lives.text = "Lives: %d" % lives
	if lives == 0:
		$HUD/GameOver.visible = true
		get_tree().paused = true

func _on_blink_timeout():
	if lives == 0:
		$HUD/GameOver.visible = not $HUD/GameOver.visible
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Game Rules

Practice on your own: Godot playground