CodeBlanks Logo Icon CodeBlanks

The _process method

Learn to run code every frame with _process.

_process(delta) and Game Loop

_process(delta) is the function called on every frame in Godot's main game loop. Continuous movement, keyboard and mouse inputs, or constantly changing counters are updated inside this function.

extends Node2D

func _process(delta: float):
    position.x += 100.0 * delta

Frame-Rate Independent Movement

Games can run at different frame rates such as 30, 60, or 144 FPS across different hardware. Multiplying movement by delta normalizes the distance traveled per second, ensuring the game runs at the same speed on every computer.

extends Node2D

var hiz: float = 250.0

func _process(delta: float):
    position.y += hiz * delta

Practice Define _process and _ready

Define the _process(delta) function with pass in its body. Inside _ready(), print print("Döngü hazır").

Starter code

Player.cs
extends Node2D

# _process(delta) fonksiyonunu tanımla

func _ready():
    # "Döngü hazır" mesajını yazdır
    pass

Sample solution

Player.cs
extends Node2D

func _process(delta):
    pass

func _ready():
    print("Döngü hazır")

Expected output

Döngü hazır

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What does the delta parameter passed to the _process(delta) function represent?

  • Time elapsed since the last frame in seconds Correct answer
  • Total count of nodes in the scene tree
  • Total frame count in the game
  • Aspect ratio of the screen resolution

Explanation: delta represents the time elapsed from the previous frame to this one (in seconds).

2 _process function parameter

Question
extends Node2D

func _process(____):
    pass
Answer
extends Node2D

func _process(delta):
    pass

Explanation: The _process function takes the delta parameter indicating elapsed time.

3 Game Loop Components

Term Meaning
_process() Loop function called once per frame
delta Time elapsed between two frames
FPS Frames processed per second
Bağımsız hareket Frame-independent speed using delta

All lessons in Beginner