Menu
CoddyTech

Fade Out

Part of the Game Feel section of Coddy's Godot journey. Lesson 3 of 23.

modulate is a Color with four parts: red, green, blue and alpha (a). Alpha is how solid the node looks. 1 is solid and 0 is invisible.

To tween one part of a property, write the part after a colon:

var tween = create_tween()
tween.tween_property(self, "modulate:a", 0.0, 1.0)

"modulate:a" is a single number, so the end value is 0.0. Red, green and blue stay the same. This also works for "position:x" and "scale:y".

A fade is not the same as visible = false. The node stays visible but becomes fully see-through.

challenge icon

Challenge

Easy

Make the robot fade away.

  1. In _ready(), make a tween with create_tween().
  2. Tween "modulate:a" to 0.0 over 1.0 second.

Press Play: the robot fades out. Then Check.

Try it yourself

extends Node2D

func _ready():
	pass

All lessons in Game Feel

Practice on your own: Godot playground