forked from team-sg/hero-mark-2
tasty little switch refactoring and an extra dessert :) :3 :3
This commit is contained in:
parent
5684e5b3a0
commit
a8e187a150
3 changed files with 19 additions and 6 deletions
|
@ -1,8 +1,19 @@
|
|||
tool
|
||||
extends Node2D
|
||||
|
||||
export var switch_index = 1
|
||||
export var type = "switch"
|
||||
export (String) var target_group = ""
|
||||
|
||||
func activate():
|
||||
for object in get_tree().get_nodes_in_group(str(type) + str(switch_index)):
|
||||
for object in get_tree().get_nodes_in_group(target_group):
|
||||
object.switch_action()
|
||||
|
||||
func _process(delta):
|
||||
# redraw lines every frame to account for things changing
|
||||
if Engine.editor_hint and Engine.get_frames_drawn() % 10 == 0:
|
||||
update()
|
||||
|
||||
func _draw():
|
||||
if Engine.editor_hint:
|
||||
for node in get_tree().get_nodes_in_group(target_group):
|
||||
if node is Node2D:
|
||||
draw_line(Vector2.ZERO, to_local(node.global_position), Color(0.2, 1.0, 0.0, 0.5), 1.5)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue