diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-09-08 22:35:06 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-09-08 22:35:06 +0200 |
commit | 4597189f157834c80f56b12b701fd2b2a15c2798 (patch) | |
tree | f522e9a58ec756dc27306781da99e828b195c549 /Stages/world.gd | |
parent | 7d7d845e76f78a87cf87c9464d700e52cd88ce6f (diff) |
next commit
Diffstat (limited to 'Stages/world.gd')
-rw-r--r-- | Stages/world.gd | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Stages/world.gd b/Stages/world.gd new file mode 100644 index 0000000..b5a4daa --- /dev/null +++ b/Stages/world.gd @@ -0,0 +1,34 @@ +extends Stage + + +func _ready(): + super._ready() + + #while true: + #var scene = preload("res://Units/Unit.tscn") + #var unit = scene.instantiate() + #Client.spawn_unit(unit, %Spawn) + #await get_tree().create_timer(randi_range(1, 2)).timeout + #await get_tree().create_timer(0.01).timeout + #break + + +func _input(event: InputEvent): + if event.is_action_pressed("ui_accept"): + for _i in range(0, 1): + var scene = preload("res://Units/Unit.tscn") + var unit = scene.instantiate() + Client.spawn_unit(unit, %Spawn) + + if event.is_action_pressed("spawn_box_toggle"): + hud.spawn_box.visible = not hud.spawn_box.visible + + +func _on_build_mode_button_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("builder_tower_select"): + $StateManager.set_state("StateBuild") + + +func _on_spawner_box_button_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + hud.spawn_box.visible = not hud.spawn_box.visible |