diff --git a/assets/icons/close.png b/assets/icons/close.png new file mode 100644 index 0000000..83a3ca2 Binary files /dev/null and b/assets/icons/close.png differ diff --git a/assets/icons/close.png.import b/assets/icons/close.png.import new file mode 100644 index 0000000..1ca09fd --- /dev/null +++ b/assets/icons/close.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dlyy0lwxniifh" +path="res://.godot/imported/close.png-8e81c1f7f49413c3a4d65fae064a1aae.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/icons/close.png" +dest_files=["res://.godot/imported/close.png-8e81c1f7f49413c3a4d65fae064a1aae.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/assets/icons/pause.png b/assets/icons/pause.png index 9aff771..3316f2d 100644 Binary files a/assets/icons/pause.png and b/assets/icons/pause.png differ diff --git a/scenes/ui/game_stats.tscn b/scenes/ui/game_stats.tscn index 3d2cec2..f1a4a89 100644 --- a/scenes/ui/game_stats.tscn +++ b/scenes/ui/game_stats.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=4 format=3 uid="uid://cy88k4uxt1v37"] +[gd_scene load_steps=5 format=3 uid="uid://cy88k4uxt1v37"] [ext_resource type="Texture2D" uid="uid://d2d7ab8q2vik4" path="res://assets/icons/label_bg.png" id="1_1gxsd"] +[ext_resource type="Script" path="res://scripts/ui/game_stats.gd" id="1_ui7x4"] [ext_resource type="Texture2D" uid="uid://derifasksdfub" path="res://assets/icons/pause.png" id="2_imq5h"] [ext_resource type="Texture2D" uid="uid://e8dmiy1xr5g3" path="res://assets/icons/health.png" id="3_r1i66"] @@ -11,13 +12,14 @@ anchor_right = 1.0 offset_right = -2.0 offset_bottom = 51.0 grow_horizontal = 2 +script = ExtResource("1_ui7x4") [node name="Resources" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 981.0 +offset_left = 975.0 offset_top = 7.0 offset_right = 1125.0 -offset_bottom = 42.0 +offset_bottom = 48.0 texture = ExtResource("1_1gxsd") [node name="Label" type="Label" parent="Resources"] @@ -31,20 +33,32 @@ text = "999999999" horizontal_alignment = 1 vertical_alignment = 1 -[node name="PauseButton" type="TextureButton" parent="."] +[node name="Pause" type="NinePatchRect" parent="."] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -18.0 +offset_top = 10.0 +offset_right = 19.0 +offset_bottom = 45.0 +grow_horizontal = 2 +texture = ExtResource("1_1gxsd") + +[node name="PauseButton" type="TextureButton" parent="Pause"] layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -20.0 -offset_top = -22.5 -offset_right = 2028.0 -offset_bottom = 2025.5 +offset_left = -15.5 +offset_top = -15.5 +offset_right = 2032.5 +offset_bottom = 2032.5 grow_horizontal = 2 grow_vertical = 2 -scale = Vector2(0.02, 0.02) +scale = Vector2(0.015, 0.015) texture_normal = ExtResource("2_imq5h") [node name="Health" type="NinePatchRect" parent="."] diff --git a/scripts/stages/1/config.gd b/scripts/stages/1/config.gd index 8102d32..151abf6 100644 --- a/scripts/stages/1/config.gd +++ b/scripts/stages/1/config.gd @@ -3,6 +3,8 @@ extends Node class_name Config var game = { + "health": 6, + "resource": 100, "spawn_timer": 3.0, "offset": [-30.0, 30.0], "path_direction": [ diff --git a/scripts/stages/1/game_manager.gd b/scripts/stages/1/game_manager.gd index 973615f..67be33c 100644 --- a/scripts/stages/1/game_manager.gd +++ b/scripts/stages/1/game_manager.gd @@ -6,11 +6,12 @@ var config = load("res://scripts/stages/1/config.gd").new() var data = { "tower": {}, - "health": 6, - "resource": 100 + "health": config.game['health'], + "resource": config.game['resource'] } func _ready(): + $CanvasLayer/GameStats.set_resource(data['resource']) var placements = $Placements.get_children() for placement in placements: placement.connect("on_placement", on_game_placement) @@ -57,3 +58,4 @@ func on_build_tower(pos, tower_id, tower_placement_id): data['tower'][str(tower_placement_id)]['id'] = tower_id data['tower'][str(tower_placement_id)]['name'] = tower.name data['resource'] -= config.menu[tower_id]['price'] + $CanvasLayer/GameStats.set_resource(data['resource']) diff --git a/scripts/ui/game_stats.gd b/scripts/ui/game_stats.gd new file mode 100644 index 0000000..a74362e --- /dev/null +++ b/scripts/ui/game_stats.gd @@ -0,0 +1,14 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func set_resource(value): + $Resources/Label.text = str(value)