mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 15:01:53 +08:00
18 lines
376 B
GDScript
18 lines
376 B
GDScript
|
|
extends Node2D
|
||
|
|
class_name EffectController
|
||
|
|
|
||
|
|
@export var oneShot: bool = true
|
||
|
|
|
||
|
|
@onready var particles: GPUParticles2D = $"%particles"
|
||
|
|
|
||
|
|
func _ready():
|
||
|
|
particles.emitting = false
|
||
|
|
particles.one_shot = oneShot
|
||
|
|
func shot():
|
||
|
|
var cloned = particles.duplicate() as GPUParticles2D
|
||
|
|
cloned.emitting = true
|
||
|
|
add_child(cloned)
|
||
|
|
if oneShot:
|
||
|
|
await cloned.finished
|
||
|
|
cloned.queue_free()
|