diff options
Diffstat (limited to 'UI')
-rw-r--r-- | UI/Assets/ButtonBackground.kra | bin | 93789 -> 125599 bytes | |||
-rw-r--r-- | UI/Assets/ButtonBackground.kra~ | bin | 83270 -> 125614 bytes | |||
-rw-r--r-- | UI/Assets/ButtonBasher.png | bin | 0 -> 286 bytes | |||
-rw-r--r-- | UI/Assets/ButtonBasher.png.import | 34 | ||||
-rw-r--r-- | UI/Assets/ButtonBuilder.png | bin | 0 -> 276 bytes | |||
-rw-r--r-- | UI/Assets/ButtonBuilder.png.import | 34 | ||||
-rw-r--r-- | UI/Assets/ButtonClimber.png | bin | 0 -> 282 bytes | |||
-rw-r--r-- | UI/Assets/ButtonClimber.png.import | 34 | ||||
-rw-r--r-- | UI/HUD.tscn | 74 | ||||
-rw-r--r-- | UI/button.gdshader | 14 | ||||
-rw-r--r-- | UI/hud.gd | 33 |
11 files changed, 215 insertions, 8 deletions
diff --git a/UI/Assets/ButtonBackground.kra b/UI/Assets/ButtonBackground.kra Binary files differindex 01cc26c..326b497 100644 --- a/UI/Assets/ButtonBackground.kra +++ b/UI/Assets/ButtonBackground.kra diff --git a/UI/Assets/ButtonBackground.kra~ b/UI/Assets/ButtonBackground.kra~ Binary files differindex 064553c..e8ac47b 100644 --- a/UI/Assets/ButtonBackground.kra~ +++ b/UI/Assets/ButtonBackground.kra~ diff --git a/UI/Assets/ButtonBasher.png b/UI/Assets/ButtonBasher.png Binary files differnew file mode 100644 index 0000000..f208aea --- /dev/null +++ b/UI/Assets/ButtonBasher.png diff --git a/UI/Assets/ButtonBasher.png.import b/UI/Assets/ButtonBasher.png.import new file mode 100644 index 0000000..eeeb4e0 --- /dev/null +++ b/UI/Assets/ButtonBasher.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8osfrnc4myw0" +path="res://.godot/imported/ButtonBasher.png-fbb22ac75623ac93a0d316e7fa9aad4a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonBasher.png" +dest_files=["res://.godot/imported/ButtonBasher.png-fbb22ac75623ac93a0d316e7fa9aad4a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/Assets/ButtonBuilder.png b/UI/Assets/ButtonBuilder.png Binary files differnew file mode 100644 index 0000000..43f2ac8 --- /dev/null +++ b/UI/Assets/ButtonBuilder.png diff --git a/UI/Assets/ButtonBuilder.png.import b/UI/Assets/ButtonBuilder.png.import new file mode 100644 index 0000000..295d07f --- /dev/null +++ b/UI/Assets/ButtonBuilder.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dulw2grnjhxht" +path="res://.godot/imported/ButtonBuilder.png-31d072f3c269b5ac50e74b743c2cf437.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonBuilder.png" +dest_files=["res://.godot/imported/ButtonBuilder.png-31d072f3c269b5ac50e74b743c2cf437.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/Assets/ButtonClimber.png b/UI/Assets/ButtonClimber.png Binary files differnew file mode 100644 index 0000000..5fee441 --- /dev/null +++ b/UI/Assets/ButtonClimber.png diff --git a/UI/Assets/ButtonClimber.png.import b/UI/Assets/ButtonClimber.png.import new file mode 100644 index 0000000..3d3655a --- /dev/null +++ b/UI/Assets/ButtonClimber.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cts81g3wb5khe" +path="res://.godot/imported/ButtonClimber.png-2dcd2f2a5ec4a4bd1a651f3b1b7caa56.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonClimber.png" +dest_files=["res://.godot/imported/ButtonClimber.png-2dcd2f2a5ec4a4bd1a651f3b1b7caa56.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/UI/HUD.tscn b/UI/HUD.tscn index b060ce3..5ef4b02 100644 --- a/UI/HUD.tscn +++ b/UI/HUD.tscn @@ -1,13 +1,53 @@ -[gd_scene load_steps=9 format=3 uid="uid://d0mlxe0gcctle"] +[gd_scene load_steps=22 format=3 uid="uid://d0mlxe0gcctle"] [ext_resource type="Script" path="res://UI/hud.gd" id="1_rpghv"] [ext_resource type="Texture2D" uid="uid://nypt5ybs2yjf" path="res://UI/Assets/ButtonBlocker.png" id="2_6o4l1"] [ext_resource type="Theme" uid="uid://lpvaxe35v64b" path="res://UI/theme.tres" id="2_he3is"] [ext_resource type="Texture2D" uid="uid://bg118k8yia0bf" path="res://UI/Assets/ButtonDigger.png" id="3_585t4"] +[ext_resource type="Shader" path="res://UI/button.gdshader" id="3_v2jeg"] [ext_resource type="Texture2D" uid="uid://wreo4yu472g8" path="res://UI/Assets/ButtonPlus.png" id="4_dku02"] [ext_resource type="Texture2D" uid="uid://c0hcl4yvb02wx" path="res://UI/Assets/ButtonMiner.png" id="5_5j5y4"] [ext_resource type="Texture2D" uid="uid://dg3qtw0fdjmt5" path="res://UI/Assets/ButtonMinus.png" id="5_ybavg"] +[ext_resource type="Texture2D" uid="uid://c8osfrnc4myw0" path="res://UI/Assets/ButtonBasher.png" id="6_p3ffi"] [ext_resource type="Texture2D" uid="uid://61yuhqwes5hw" path="res://UI/Assets/ButtonFloater.png" id="6_qnbw6"] +[ext_resource type="Texture2D" uid="uid://dulw2grnjhxht" path="res://UI/Assets/ButtonBuilder.png" id="8_wjtr6"] +[ext_resource type="Texture2D" uid="uid://cts81g3wb5khe" path="res://UI/Assets/ButtonClimber.png" id="9_tcs2a"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_tsgkc"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_vfiay"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_22xig"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_sotrm"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ekuuk"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_gowx5"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_soqe0"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ywy56"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ascmt"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 [node name="HUD" type="CanvasLayer"] script = ExtResource("1_rpghv") @@ -46,7 +86,9 @@ theme = ExtResource("2_he3is") theme_override_constants/separation = 0 [node name="ButtonBlocker" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_tsgkc") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -54,7 +96,9 @@ texture = ExtResource("2_6o4l1") stretch_mode = 5 [node name="ButtonDigger" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_vfiay") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -62,7 +106,9 @@ texture = ExtResource("3_585t4") stretch_mode = 5 [node name="ButtonMiner" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_22xig") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -70,15 +116,19 @@ texture = ExtResource("5_5j5y4") stretch_mode = 5 [node name="ButtonBasher" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_sotrm") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 -texture = ExtResource("3_585t4") +texture = ExtResource("6_p3ffi") stretch_mode = 5 [node name="ButtonFloater" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_ekuuk") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -86,23 +136,29 @@ texture = ExtResource("6_qnbw6") stretch_mode = 5 [node name="ButtonBuilder" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_gowx5") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 -texture = ExtResource("3_585t4") +texture = ExtResource("8_wjtr6") stretch_mode = 5 [node name="ButtonClimber" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_soqe0") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 -texture = ExtResource("3_585t4") +texture = ExtResource("9_tcs2a") stretch_mode = 5 [node name="ButtonPlus" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_ywy56") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -110,7 +166,9 @@ texture = ExtResource("4_dku02") stretch_mode = 5 [node name="ButtonMinus" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_ascmt") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -120,9 +178,9 @@ stretch_mode = 5 [connection signal="gui_input" from="HBoxContainer/ButtonBlocker" to="." method="_on_button_blocker_gui_input"] [connection signal="gui_input" from="HBoxContainer/ButtonDigger" to="." method="_on_button_digger_gui_input"] [connection signal="gui_input" from="HBoxContainer/ButtonMiner" to="." method="_on_button_miner_gui_input"] -[connection signal="gui_input" from="HBoxContainer/ButtonBasher" to="." method="_on_button_digger_gui_input"] -[connection signal="gui_input" from="HBoxContainer/ButtonFloater" to="." method="_on_button_digger_gui_input"] -[connection signal="gui_input" from="HBoxContainer/ButtonBuilder" to="." method="_on_button_digger_gui_input"] -[connection signal="gui_input" from="HBoxContainer/ButtonClimber" to="." method="_on_button_digger_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonBasher" to="." method="_on_button_basher_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonFloater" to="." method="_on_button_floater_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonBuilder" to="." method="_on_button_builder_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonClimber" to="." method="_on_button_climber_gui_input"] [connection signal="gui_input" from="HBoxContainer/ButtonPlus" to="." method="_on_button_plus_gui_input"] [connection signal="gui_input" from="HBoxContainer/ButtonMinus" to="." method="_on_button_minus_gui_input"] diff --git a/UI/button.gdshader b/UI/button.gdshader new file mode 100644 index 0000000..0c89fa5 --- /dev/null +++ b/UI/button.gdshader @@ -0,0 +1,14 @@ +shader_type canvas_item; + +uniform float adjust = 0.0; + +void fragment() { + // Called for every pixel the material is visible on. + vec4 tex = texture(TEXTURE, UV); + + if (adjust < 0.0) { + COLOR.rgb = tex.rgb - vec3(0.2); + } else if (adjust > 0.0) { + COLOR.rgb = tex.rgb + vec3(0.2); + } +}
\ No newline at end of file @@ -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: |