diff options
Diffstat (limited to 'UI/hud.gd')
-rw-r--r-- | UI/hud.gd | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -1,6 +1,15 @@ extends CanvasLayer +var selected_button: TextureRect : + set(value): + if selected_button: + (selected_button.material as ShaderMaterial).set_shader_parameter("adjust", 0.0) + + selected_button = value + (selected_button.material as ShaderMaterial).set_shader_parameter("adjust", -1.0) + + func _ready() -> void: Game.score_changed.connect(func(): %Score.text = str(Game.score) @@ -14,14 +23,38 @@ func _ready() -> void: func _on_button_blocker_gui_input(event: InputEvent) -> void: if event.is_action_pressed("select"): Game.selected_unit_type = preload("res://Units/Blocker.tscn") + selected_button = %ButtonBlocker func _on_button_digger_gui_input(event: InputEvent) -> void: if event.is_action_pressed("select"): Game.selected_unit_type = preload("res://Units/Digger.tscn") + selected_button = %ButtonDigger func _on_button_miner_gui_input(event: InputEvent) -> void: if event.is_action_pressed("select"): Game.selected_unit_type = preload("res://Units/Miner.tscn") + selected_button = %ButtonMiner + +func _on_button_basher_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.selected_unit_type = preload("res://Units/Basher.tscn") + selected_button = %ButtonBasher + +func _on_button_floater_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + #Game.selected_unit_type = preload("res://Units/Floater.tscn") + selected_button = %ButtonFloater + +func _on_button_builder_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + #Game.selected_unit_type = preload("res://Units/Builder.tscn") + selected_button = %ButtonBuilder + +func _on_button_climber_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.selected_unit_type = preload("res://Units/Climber.tscn") + selected_button = %ButtonClimber + func _on_button_plus_gui_input(event: InputEvent) -> void: |