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
EasyStart the screensaver: make the logo drift.
- At the top of
logo.gd, add a node variablevelocity, set toVector2(200, 90). - In
_process(), move the logo byvelocityper second, withdelta.
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
1Your First Godot Game
What Is Godot?Ready Runs OncePrint in GodotThe Scene TreeSet a PositionMove a Node Once2Every Frame
Process Runs Every FrameDeltaPixels per SecondMove DiagonallySpin With RotationGrow With Scale5Project: Screensaver
Screensaver: DriftScreensaver: Side WallsPractice on your own: Godot playground