-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlobals.gd
More file actions
31 lines (26 loc) · 902 Bytes
/
Globals.gd
File metadata and controls
31 lines (26 loc) · 902 Bytes
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
extends Node3D
func _ready():
for i in range(maxprojectiles):
var proj = load("res://enemies/projectile_2.tscn").instantiate()
Globals.add_child(proj)
proj.hide()
proj.process_mode = Node.PROCESS_MODE_DISABLED
var maxprojectiles := 9999
func Projectile(group : String = "Projectile"):
if(get_tree().get_nodes_in_group(group).size() < maxprojectiles):
var proj
if(group == "Projectile"):
proj = load("res://enemies/projectile_2.tscn").instantiate()
elif(group == "Ring"):
return load("res://Projectiles/Ring.tscn").instantiate()
Globals.add_child(proj)
return proj
for i in get_tree().get_nodes_in_group(group):
if(i.process_mode == Node.PROCESS_MODE_DISABLED):
i.process_mode = Node.PROCESS_MODE_INHERIT
return i
const groups = ["Projectile","Ring"]
func ClearProjectiles():
for group in groups:
for i in get_tree().get_nodes_in_group(group):
i.Perish()