Menu
CoddyTech

Screensaver: Drift

Part of the Nodes and Scenes section of Coddy's Godot journey. Lesson 24 of 28.

In the next five lessons you build a screensaver: a logo that drifts around the screen, bounces off the edges and changes color on every bounce.

The scene has a dark sky and a Logo node with a white plate, a shadow and a Label. The logo's modulate tints the plate blue. Its script, logo.gd, does nothing yet.

The first step is a velocity. Keep it in a node variable, so later steps can change it when the logo bounces.

challenge icon

Challenge

Easy

Start the screensaver: make the logo drift.

  1. At the top of logo.gd, add a node variable velocity, set to Vector2(200, 90).
  2. In _process(), move the logo by velocity per second, with delta.

Press Play: the logo drifts down and right, off the screen for now. Then Check.

Try it yourself

extends Node2D

func _process(delta):
	pass

All lessons in Nodes and Scenes

Practice on your own: Godot playground