Menu
CoddyTech

Flash on a Hit

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

A white flash shows the player at once that something was hit.

modulate multiplies the node's colors. Color(1, 1, 1) changes nothing, so it is a node's normal value. Numbers above 1 make the colors brighter. Color(4, 4, 4) makes the robot almost white.

modulate = Color(4, 4, 4)

Then tween modulate back to Color(1, 1, 1). The robot fades back to its own colors in a fraction of a second.

In this game, pressing E calls the robot's hit() function.

challenge icon

Challenge

Easy

In hit(), flash the robot:

  1. set modulate to Color(4, 4, 4),
  2. tween modulate back to Color(1, 1, 1) in 0.3 seconds.

Press E to try it.

Try it yourself

extends Node2D

func hit():
	pass
quiz iconTest yourself

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

All lessons in Game Feel

Practice on your own: Godot playground