A One Shot Burst
Part of the Game Feel section of Coddy's Godot journey. Lesson 13 of 23.
The Thruster never stops. When a particle dies, a new one replaces it. A spark or an explosion happens once and ends.
one_shot = true makes a CPUParticles2D throw out its particles once, then stop. emitting turns back to false when the last particle dies. Set it to true again to fire another round.
$Burst.one_shot = true
$Burst.emitting = trueThe robot's Burst node also has explosiveness = 1.0. All its particles come out in the same instant instead of one after another.
Challenge
EasyMake the robot spark when you press E.
- In
_ready(), set$Burst.one_shottotrue. - In
_process(), when"action"is just pressed, set$Burst.emittingtotrue.
Press Play and press E: one burst of sparks flies out. Then Check.
Try it yourself
extends Node2D
func _ready():
$Thruster.emitting = true
func _process(delta):
pass
All lessons in Game Feel
Practice on your own: Godot playground