-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfetti.gd
More file actions
58 lines (45 loc) · 1.43 KB
/
confetti.gd
File metadata and controls
58 lines (45 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
extends Node2D
var active = false
@onready var particle_1 = $CPUParticles2D
@onready var particle_2 = $CPUParticles2D2
@onready var particle_3 = $CPUParticles2D3
@onready var particle_4 = $CPUParticles2D4
func activate():
if active == false:
active = true
particle_1.emitting = true
particle_2.emitting = true
particle_3.emitting = true
particle_4.emitting = true
await get_tree().create_timer(5).timeout
particle_1.lifetime = 1.4
particle_2.lifetime = 1.4
particle_3.lifetime = 1.4
particle_4.lifetime = 1.4
particle_1.explosiveness = 0.2
particle_2.explosiveness = 0.2
particle_3.explosiveness = 0.2
particle_4.explosiveness = 0.2
particle_1.initial_velocity_min = 60
particle_2.initial_velocity_min = 60
particle_3.initial_velocity_min = 60
particle_4.initial_velocity_min = 60
particle_1.initial_velocity_max = 140
particle_2.initial_velocity_max = 140
particle_3.initial_velocity_max = 140
particle_4.initial_velocity_max = 140
particle_1.amount = 50
particle_2.amount = 50
particle_3.amount = 50
particle_4.amount = 50
particle_1.one_shot = false
particle_2.one_shot = false
particle_3.one_shot = false
particle_4.one_shot = false
particle_1.emitting = true
particle_2.emitting = true
particle_3.emitting = true
particle_4.emitting = true
func _on_confetti_activate_area_body_entered(body: Node2D) -> void:
if body.name == "Player" and not active:
activate()