diff options
-rw-r--r-- | assets/tilemap.png | bin | 25306 -> 25306 bytes | |||
-rw-r--r-- | assets/tilemap.xcf | bin | 227048 -> 227048 bytes | |||
-rw-r--r-- | export_presets.cfg | 43 | ||||
-rw-r--r-- | project.godot | 2 | ||||
-rw-r--r-- | resources/game_stats_config.tres | 69 | ||||
-rw-r--r-- | scenes/game_over.tscn | 41 | ||||
-rw-r--r-- | scenes/title.tscn | 21 | ||||
-rw-r--r-- | scenes/ui.tscn | 2 | ||||
-rw-r--r-- | scenes/ui_option.tscn | 10 | ||||
-rw-r--r-- | scripts/game_data.gd | 13 | ||||
-rw-r--r-- | scripts/game_over.gd | 5 | ||||
-rw-r--r-- | scripts/game_over.gd.uid | 1 | ||||
-rw-r--r-- | scripts/player.gd | 1 | ||||
-rw-r--r-- | scripts/title.gd (renamed from scenes/title.gd) | 0 | ||||
-rw-r--r-- | scripts/title.gd.uid (renamed from scenes/title.gd.uid) | 0 | ||||
-rw-r--r-- | scripts/ui_panel.gd | 12 |
16 files changed, 165 insertions, 55 deletions
diff --git a/assets/tilemap.png b/assets/tilemap.png Binary files differindex dbad734..e7a3a1f 100644 --- a/assets/tilemap.png +++ b/assets/tilemap.png diff --git a/assets/tilemap.xcf b/assets/tilemap.xcf Binary files differindex 089dcad..42eb05d 100644 --- a/assets/tilemap.xcf +++ b/assets/tilemap.xcf diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..7dbafbb --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,43 @@ +[preset.0] + +name="castle_of_alethane" +platform="Web" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../castle_exported/index.html" +patches=PackedStringArray() +encryption_include_filters="" +encryption_exclude_filters="" +seed=0 +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +variant/extensions_support=false +variant/thread_support=false +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=false +html/export_icon=true +html/custom_html_shell="" +html/head_include="" +html/canvas_resize_policy=2 +html/focus_canvas_on_start=true +html/experimental_virtual_keyboard=false +progressive_web_app/enabled=false +progressive_web_app/ensure_cross_origin_isolation_headers=true +progressive_web_app/offline_page="" +progressive_web_app/display=1 +progressive_web_app/orientation=0 +progressive_web_app/icon_144x144="" +progressive_web_app/icon_180x180="" +progressive_web_app/icon_512x512="" +progressive_web_app/background_color=Color(0, 0, 0, 1) diff --git a/project.godot b/project.godot index 5725dca..d56a28a 100644 --- a/project.godot +++ b/project.godot @@ -10,7 +10,7 @@ config_version=5 [application] -config/name="pixel-defense-2" +config/name="castle of alethane" run/main_scene="uid://cgoebhfu5udrc" config/features=PackedStringArray("4.4", "GL Compatibility") config/icon="res://icon.svg" diff --git a/resources/game_stats_config.tres b/resources/game_stats_config.tres index 97b06f4..78394a8 100644 --- a/resources/game_stats_config.tres +++ b/resources/game_stats_config.tres @@ -9,8 +9,7 @@ starting_morale = 10 max_wave = 3 wave_time = 20.0 wave_targets = [15, 40, 120] -defenders = Dictionary[String, Dictionary]({ -"warlock": { +defenders = Array[Dictionary]([{ "cost": 10, "damage": 4.0, "desc": "Warlock", @@ -20,16 +19,21 @@ defenders = Dictionary[String, Dictionary]({ "sprite_attacking": Vector2i(28, 1), "sprite_idle": Vector2i(29, 1), "sprite_panel": Vector2i(32, 4), -"upgrades": { -"tower_action_one": { +"upgrades": [{ "cost": 12, "desc": "Phoenix (DMG)", "effects": { "damage": 9.0 }, "sprite_panel": Vector2i(32, 5) +}, { +"cost": 7, +"desc": "Sparrow (DUP)", +"effects": { +"fire_rate": 1.7 }, -"tower_action_three": { +"sprite_panel": Vector2i(35, 5) +}, { "cost": 20, "desc": "Falcon (RNGE)", "effects": { @@ -39,29 +43,19 @@ defenders = Dictionary[String, Dictionary]({ "sprite_idle": Vector2i(31, 1) }, "sprite_panel": Vector2i(34, 4) -}, -"tower_action_two": { -"cost": 7, -"desc": "Sparrow (DUP)", -"effects": { -"fire_rate": 1.7 -}, -"sprite_panel": Vector2i(35, 5) -} -} -}, -"wellspring": { -"cost": 1, +}] +}, { +"cost": 15, "damage": 1.0, -"desc": "Wellspring", +"damage_tick_rate": 0.25, +"desc": "Wyvern", "fire_rate": 1.0, -"range": 1.0, -"sprite_attacking": Vector2i(38, 11), -"sprite_idle": Vector2i(38, 11), -"sprite_panel": Vector2i(38, 11), -"upgrades": {} -}, -"werewolf": { +"range": 35.0, +"sprite_attacking": Vector2i(25, 10), +"sprite_idle": Vector2i(24, 10), +"sprite_panel": Vector2i(28, 11), +"upgrades": [] +}, { "cost": 1, "damage": 1.0, "desc": "Werewolf", @@ -70,21 +64,18 @@ defenders = Dictionary[String, Dictionary]({ "sprite_attacking": Vector2i(26, 11), "sprite_idle": Vector2i(26, 11), "sprite_panel": Vector2i(26, 11), -"upgrades": {} -}, -"wyvern": { -"cost": 15, +"upgrades": [] +}, { +"cost": 1, "damage": 1.0, -"damage_tick_rate": 0.25, -"desc": "Wyvern", +"desc": "Wellspring", "fire_rate": 1.0, -"range": 35.0, -"sprite_attacking": Vector2i(25, 10), -"sprite_idle": Vector2i(24, 10), -"sprite_panel": Vector2i(28, 11), -"upgrades": {} -} -}) +"range": 1.0, +"sprite_attacking": Vector2i(38, 11), +"sprite_idle": Vector2i(38, 11), +"sprite_panel": Vector2i(38, 11), +"upgrades": [] +}]) crawlers = Dictionary[String, Dictionary]({ "fodder": { "damage": 1.0, diff --git a/scenes/game_over.tscn b/scenes/game_over.tscn new file mode 100644 index 0000000..9ef136a --- /dev/null +++ b/scenes/game_over.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=3 format=3 uid="uid://c2qy3yacnarar"] + +[ext_resource type="Script" uid="uid://d4ayvqargsfbd" path="res://scripts/game_over.gd" id="1_wqhvx"] +[ext_resource type="AudioStream" uid="uid://b6gqbdoic7lr4" path="res://assets/11 - Death's Respite.wav" id="2_wqhvx"] + +[node name="GameOver" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_wqhvx") + +[node name="TextureRect" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +expand_mode = 2 + +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("2_wqhvx") +pitch_scale = 0.7 +autoplay = true + +[node name="Label" type="Label" parent="."] +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -20.0 +grow_horizontal = 2 +grow_vertical = 0 +theme_override_colors/font_color = Color(1, 0.921569, 0.862745, 1) +theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) +text = "space to go back..." +horizontal_alignment = 2 diff --git a/scenes/title.tscn b/scenes/title.tscn index 59450e7..1380aba 100644 --- a/scenes/title.tscn +++ b/scenes/title.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=7 format=3 uid="uid://cgoebhfu5udrc"] -[ext_resource type="Texture2D" uid="uid://cgmfpwb1eb88v" path="res://assets/title.png" id="1_4ignj"] -[ext_resource type="Script" uid="uid://cxmpltan4gkpt" path="res://scenes/title.gd" id="1_wosw1"] -[ext_resource type="AudioStream" uid="uid://coam5ivql7fwj" path="res://assets/13 - The Regret of Victory.wav" id="3_p6dhs"] -[ext_resource type="Script" uid="uid://1d5icis2ddhc" path="res://scripts/audio_looper.gd" id="4_pyl7j"] -[ext_resource type="Shader" uid="uid://d3ktu01mh01ao" path="res://resources/oscillating_text.gdshader" id="5_b3w7a"] +[ext_resource type="Script" uid="uid://cxmpltan4gkpt" path="res://scripts/title.gd" id="1_iryts"] +[ext_resource type="Texture2D" uid="uid://cgmfpwb1eb88v" path="res://assets/title.png" id="2_tkqx6"] +[ext_resource type="AudioStream" uid="uid://coam5ivql7fwj" path="res://assets/13 - The Regret of Victory.wav" id="3_k8ybh"] +[ext_resource type="Script" uid="uid://1d5icis2ddhc" path="res://scripts/audio_looper.gd" id="4_5kvca"] +[ext_resource type="Shader" uid="uid://d3ktu01mh01ao" path="res://resources/oscillating_text.gdshader" id="5_13ku0"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_4rr2b"] -shader = ExtResource("5_b3w7a") +shader = ExtResource("5_13ku0") shader_parameter/height = 2.0 shader_parameter/freq = 3.0 shader_parameter/speed = 5.0 @@ -19,7 +19,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -script = ExtResource("1_wosw1") +script = ExtResource("1_iryts") [node name="TextureRect" type="TextureRect" parent="."] layout_mode = 1 @@ -28,13 +28,13 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -texture = ExtResource("1_4ignj") +texture = ExtResource("2_tkqx6") expand_mode = 2 [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] -stream = ExtResource("3_p6dhs") +stream = ExtResource("3_k8ybh") autoplay = true -script = ExtResource("4_pyl7j") +script = ExtResource("4_5kvca") [node name="Label" type="Label" parent="."] material = SubResource("ShaderMaterial_4rr2b") @@ -47,6 +47,7 @@ offset_top = -28.0 offset_bottom = -28.0 grow_horizontal = 2 grow_vertical = 0 +theme_override_colors/font_color = Color(1, 0.921569, 0.862745, 1) theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) text = "press 'space'" horizontal_alignment = 1 diff --git a/scenes/ui.tscn b/scenes/ui.tscn index 74e591e..7e7848e 100644 --- a/scenes/ui.tscn +++ b/scenes/ui.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://biw5cwtetstux" path="res://scripts/ui.gd" id="1_yev5y"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nt14h"] -bg_color = Color(0, 0.0117647, 0.552941, 1) +bg_color = Color(0.000440926, 0.159154, 0.585059, 1) [node name="UI" type="PanelContainer"] anchors_preset = 10 diff --git a/scenes/ui_option.tscn b/scenes/ui_option.tscn index 21468c6..81e77d9 100644 --- a/scenes/ui_option.tscn +++ b/scenes/ui_option.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://do8a8uq1jvs7b" path="res://scripts/ui_panel.gd" id="1_c3u8h"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sv14y"] -bg_color = Color(0, 0.00526825, 0.379014, 1) +bg_color = Color(0.000427233, 0.12281, 0.492369, 1) [node name="UIOption" type="Panel"] custom_minimum_size = Vector2(16, 16) @@ -32,3 +32,11 @@ theme_override_font_sizes/font_size = 8 [node name="Label2" type="Label" parent="HBoxContainer/VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 8 + +[node name="ColorRect" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/scripts/game_data.gd b/scripts/game_data.gd index 0ed0f61..f03eaa7 100644 --- a/scripts/game_data.gd +++ b/scripts/game_data.gd @@ -4,9 +4,14 @@ var game_stats_config = preload("res://resources/game_stats_config.tres") signal life_changed signal morale_changed -var _life : int = game_stats_config.starting_life -var _morale : int = game_stats_config.starting_morale -var _current_wave : int = 1 +var _life : int +var _morale : int +var _current_wave : int + +func reset(): + _life = game_stats_config.starting_life + _morale = game_stats_config.starting_morale + _current_wave = 1 func get_life() -> int: return _life @@ -29,6 +34,8 @@ func add_morale(amount: int): func subtract_morale(amount: int): _morale -= amount emit_signal("morale_changed") + if (_morale < 1): + get_tree().change_scene_to_file("res://scenes/game_over.tscn") func get_current_wave() -> int: return _current_wave diff --git a/scripts/game_over.gd b/scripts/game_over.gd new file mode 100644 index 0000000..9e00c37 --- /dev/null +++ b/scripts/game_over.gd @@ -0,0 +1,5 @@ +extends Control + +func _input(event): + if event.is_action_pressed("ui_accept"): + get_tree().change_scene_to_file("res://scenes/title.tscn") diff --git a/scripts/game_over.gd.uid b/scripts/game_over.gd.uid new file mode 100644 index 0000000..b126122 --- /dev/null +++ b/scripts/game_over.gd.uid @@ -0,0 +1 @@ +uid://d4ayvqargsfbd diff --git a/scripts/player.gd b/scripts/player.gd index f399f02..b26beac 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -24,6 +24,7 @@ var tower_ids = { signal curr_tile(tile_state) func _ready(): + GameData.reset() _max_x = map_config.grid_width * map_config.tile_size _max_y = map_config.grid_height * map_config.tile_size position = position.snapped(Vector2.ONE * map_config.tile_size) diff --git a/scenes/title.gd b/scripts/title.gd index 8242145..8242145 100644 --- a/scenes/title.gd +++ b/scripts/title.gd diff --git a/scenes/title.gd.uid b/scripts/title.gd.uid index 163f43d..163f43d 100644 --- a/scenes/title.gd.uid +++ b/scripts/title.gd.uid diff --git a/scripts/ui_panel.gd b/scripts/ui_panel.gd index 6d3ea5a..d28812b 100644 --- a/scripts/ui_panel.gd +++ b/scripts/ui_panel.gd @@ -12,3 +12,15 @@ func _ready(): $HBoxContainer/Texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED $HBoxContainer/VBoxContainer/Label.text = desc $HBoxContainer/VBoxContainer/Label2.text = str(cost) + print(get_theme_stylebox("panel").bg_color) + $ColorRect.color = get_theme_stylebox("panel").bg_color + $ColorRect.modulate.a = 0.0 + + GameData.connect("life_changed", Callable(self, "_update_affordability")) + _update_affordability() + +func _update_affordability(): + if (GameData.get_life() >= cost): + $ColorRect.modulate.a = 0.0 + else: + $ColorRect.modulate.a = 0.75 |