summaryrefslogtreecommitdiff
path: root/Stages
diff options
context:
space:
mode:
Diffstat (limited to 'Stages')
-rw-r--r--Stages/Stage.gd15
-rw-r--r--Stages/world.gd13
-rw-r--r--Stages/world.tscn5
3 files changed, 10 insertions, 23 deletions
diff --git a/Stages/Stage.gd b/Stages/Stage.gd
index fec5b76..963ee46 100644
--- a/Stages/Stage.gd
+++ b/Stages/Stage.gd
@@ -37,24 +37,17 @@ func _ready() -> void:
func place_tower(tower: Tower, position: Vector2):
- if tower.owner_id != 1:
- var id = str(tower.owner_id)
- tower.get_node("Sprite2D").modulate = Color(
- int(id.substr(0, 3)) / 255,
- int(id.substr(3, 3)) / 255,
- int(id.substr(6, 3)) / 255
- )
+ var player: Player = Network.players[tower.owner_id]
+ tower.get_node("Sprite2D").modulate = player.get_color()
tower.global_position = position
fill_tower_region(tower, true)
towers.add_child(tower)
- path_grid_changed.emit()
func destroy_tower(tower: Tower):
fill_tower_region(tower, false)
tower.queue_free()
- path_grid_changed.emit()
func fill_tower_region(tower: Tower, solid = true):
@@ -76,8 +69,12 @@ func fill_tower_region(tower: Tower, solid = true):
),
solid
)
+ path_grid_changed.emit()
@warning_ignore("shadowed_variable")
func spawn_unit(unit: Unit, _spawn: Spawn):
+ var player: Player = Network.players[unit.owner_id]
+ unit.get_node("Sprite2D").modulate = player.get_color()
+
units.add_child(unit)
diff --git a/Stages/world.gd b/Stages/world.gd
index b5a4daa..0549a1c 100644
--- a/Stages/world.gd
+++ b/Stages/world.gd
@@ -19,16 +19,3 @@ func _input(event: InputEvent):
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
diff --git a/Stages/world.tscn b/Stages/world.tscn
index d1072e1..e53d874 100644
--- a/Stages/world.tscn
+++ b/Stages/world.tscn
@@ -1,10 +1,11 @@
-[gd_scene load_steps=15 format=4 uid="uid://bl65jllb3e2py"]
+[gd_scene load_steps=16 format=4 uid="uid://bl65jllb3e2py"]
[ext_resource type="Texture2D" uid="uid://b1b18rd0tqbar" path="res://core_outdoor.png" id="1_luil3"]
[ext_resource type="Script" path="res://Stages/world.gd" id="1_o88ua"]
[ext_resource type="PackedScene" uid="uid://bylx30cweulmk" path="res://UI/HUD.tscn" id="2_v3f6l"]
[ext_resource type="PackedScene" uid="uid://of5ggu6lifwy" path="res://Stages/Paths/Spawn.tscn" id="3_f2sda"]
[ext_resource type="PackedScene" uid="uid://2lt8m7df0e2u" path="res://Stages/Paths/Goal.tscn" id="5_dp16q"]
+[ext_resource type="PackedScene" uid="uid://ic2hc7gr27p3" path="res://Game/Selection/SelectionRectangle.tscn" id="6_7dk4w"]
[ext_resource type="PackedScene" uid="uid://d0ukgoppkh1fn" path="res://Stages/Paths/PathNode.tscn" id="6_lh0f6"]
[ext_resource type="PackedScene" uid="uid://t8feyd2giabm" path="res://UI/Camera.tscn" id="6_yijl8"]
[ext_resource type="PackedScene" uid="uid://by1x56w21o165" path="res://Towers/Tower.tscn" id="7_5o3d3"]
@@ -1958,6 +1959,8 @@ zoom = Vector2(1.5, 1.5)
drag_horizontal_enabled = true
drag_vertical_enabled = true
+[node name="SelectionRectangle" parent="." instance=ExtResource("6_7dk4w")]
+
[node name="Paths" type="Node" parent="."]
[node name="Spawn" parent="Paths" node_paths=PackedStringArray("next_node") instance=ExtResource("3_f2sda")]