diff --git a/assets/fonts/pixel_font.ttf b/assets/fonts/pixel_font.ttf new file mode 100644 index 0000000..5e8ca05 Binary files /dev/null and b/assets/fonts/pixel_font.ttf differ diff --git a/assets/fonts/pixel_font.ttf.import b/assets/fonts/pixel_font.ttf.import new file mode 100644 index 0000000..bab13fb --- /dev/null +++ b/assets/fonts/pixel_font.ttf.import @@ -0,0 +1,36 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://cqrxu8aj7ih08" +path="res://.godot/imported/pixel_font.ttf-9b91c6087dd1107f01042d9c92857112.fontdata" + +[deps] + +source_file="res://assets/fonts/pixel_font.ttf" +dest_files=["res://.godot/imported/pixel_font.ttf-9b91c6087dd1107f01042d9c92857112.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +modulate_color_glyphs=false +hinting=3 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/assets/images/title-screen.png b/assets/images/title-screen.png new file mode 100644 index 0000000..a159be2 Binary files /dev/null and b/assets/images/title-screen.png differ diff --git a/assets/images/title-screen.png.import b/assets/images/title-screen.png.import new file mode 100644 index 0000000..3ff2008 --- /dev/null +++ b/assets/images/title-screen.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ysydrha7qlmx" +path="res://.godot/imported/title-screen.png-bba5c7a86c6bb926f544dfc8100d61cb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/title-screen.png" +dest_files=["res://.godot/imported/title-screen.png-bba5c7a86c6bb926f544dfc8100d61cb.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/images/title-screen_2.png b/assets/images/title-screen_2.png new file mode 100644 index 0000000..6d2586a Binary files /dev/null and b/assets/images/title-screen_2.png differ diff --git a/assets/images/title-screen_2.png.import b/assets/images/title-screen_2.png.import new file mode 100644 index 0000000..12ce5a2 --- /dev/null +++ b/assets/images/title-screen_2.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ceit66e5fvtsq" +path="res://.godot/imported/title-screen_2.png-80d240d25b8bcdfba0ac931b94467fe8.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/title-screen_2.png" +dest_files=["res://.godot/imported/title-screen_2.png-80d240d25b8bcdfba0ac931b94467fe8.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/images/ui/GUI.png b/assets/images/ui/GUI.png new file mode 100644 index 0000000..f8ad904 Binary files /dev/null and b/assets/images/ui/GUI.png differ diff --git a/assets/images/ui/GUI.png.import b/assets/images/ui/GUI.png.import new file mode 100644 index 0000000..55c79d4 --- /dev/null +++ b/assets/images/ui/GUI.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bvnmoenc8upoi" +path="res://.godot/imported/GUI.png-98c89ba3d3eee1cb05596c4152fb8dbd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/ui/GUI.png" +dest_files=["res://.godot/imported/GUI.png-98c89ba3d3eee1cb05596c4152fb8dbd.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/images/ui/Heart.png b/assets/images/ui/Heart.png index 006472f..30c17fa 100644 Binary files a/assets/images/ui/Heart.png and b/assets/images/ui/Heart.png differ diff --git a/assets/images/ui/buttons_blue.png b/assets/images/ui/buttons_blue.png new file mode 100644 index 0000000..b456d05 Binary files /dev/null and b/assets/images/ui/buttons_blue.png differ diff --git a/assets/images/ui/buttons_blue.png.import b/assets/images/ui/buttons_blue.png.import new file mode 100644 index 0000000..622b921 --- /dev/null +++ b/assets/images/ui/buttons_blue.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bonm2ps2li41l" +path="res://.godot/imported/buttons_blue.png-4ebfc751a36fa4e50f47d48c26f08edb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/ui/buttons_blue.png" +dest_files=["res://.godot/imported/buttons_blue.png-4ebfc751a36fa4e50f47d48c26f08edb.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/images/ui/buttons_transparent.png b/assets/images/ui/buttons_transparent.png new file mode 100644 index 0000000..e28e01f Binary files /dev/null and b/assets/images/ui/buttons_transparent.png differ diff --git a/assets/images/ui/buttons_transparent.png.import b/assets/images/ui/buttons_transparent.png.import new file mode 100644 index 0000000..c77231d --- /dev/null +++ b/assets/images/ui/buttons_transparent.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dxcrflfop4315" +path="res://.godot/imported/buttons_transparent.png-0b9dc03d43acb5389ecde102cfb86501.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/images/ui/buttons_transparent.png" +dest_files=["res://.godot/imported/buttons_transparent.png-0b9dc03d43acb5389ecde102cfb86501.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/video/Title-Screen.mp4 b/assets/video/Title-Screen.mp4 new file mode 100644 index 0000000..66f2319 Binary files /dev/null and b/assets/video/Title-Screen.mp4 differ diff --git a/scenes/components/death_screen.gd b/scenes/components/death_screen.gd new file mode 100644 index 0000000..1d0c10f --- /dev/null +++ b/scenes/components/death_screen.gd @@ -0,0 +1,69 @@ +class_name DeathScreen +extends Control + +const GAME_OVER_DELAY: float = 0.3 +const VILLAGE_DESTROYED_DELAY: float = 0.7 +const OPTIONS_DELAY: float = 1.5 + +@onready var _death_sprite: AnimatedSprite2D = $PlayerDeathSprite +@onready var _game_over_label: Label = $TextLayer/GameOverLabel +@onready var _village_destroyed_label: Label = $TextLayer/VillageDestroyedLabel +@onready var _options_container: HBoxContainer = $OptionsContainer +@onready var _continue_button: Button = $OptionsContainer/ContinueButton +@onready var _title_screen_button: Button = $OptionsContainer/TitleScreenButton +@onready var _exit_button: Button = $OptionsContainer/ExitButton +@onready var _background: ColorRect = $FadeOut + +func _ready() -> void: + _reset_sequence() + _continue_button.pressed.connect(_on_continue_pressed) + _title_screen_button.pressed.connect(_on_title_screen_pressed) + _exit_button.pressed.connect(_on_exit_pressed) + _play_sequence() + +func _unhandled_input(event: InputEvent) -> void: + if not event.is_action_pressed("interact"): + return + var viewport: Viewport = get_viewport() + if viewport == null: + return + var focused: Control = viewport.gui_get_focus_owner() + if focused is Button: + (focused as Button).pressed.emit() + viewport.set_input_as_handled() + +func _play_sequence() -> void: + _death_sprite.flip_h = EventBus.last_death_facing_direction < 0.0 + _death_sprite.play("player_death") + await _death_sprite.animation_finished + await get_tree().create_timer(GAME_OVER_DELAY).timeout + _game_over_label.visible = true + AudioManager.play_sfx("game_over") + await get_tree().create_timer(VILLAGE_DESTROYED_DELAY).timeout + _village_destroyed_label.visible = true + await get_tree().create_timer(OPTIONS_DELAY).timeout + _options_container.visible = true + _continue_button.grab_focus() + +func _reset_sequence() -> void: + _game_over_label.visible = false + _village_destroyed_label.visible = false + _options_container.visible = false + +func _on_continue_pressed() -> void: + await _fade_out() + SceneManager.change_scene(EventBus.last_level_path) + +func _on_title_screen_pressed() -> void: + await _fade_out() + SceneManager.change_scene("res://scenes/components/title_screen.tscn") + +func _on_exit_pressed() -> void: + SceneManager.quit_game() + +func _fade_out() -> void: + var tween: Tween = create_tween() + tween.tween_property(_background, "color:a", 1.0, 1.2) + await tween.finished + if OS.get_name() == "Web": + JavaScriptBridge.eval("document.querySelector('canvas').focus()") diff --git a/scenes/components/death_screen.gd.uid b/scenes/components/death_screen.gd.uid new file mode 100644 index 0000000..d945b07 --- /dev/null +++ b/scenes/components/death_screen.gd.uid @@ -0,0 +1 @@ +uid://ij7vc5allaf7 diff --git a/scenes/components/death_screen.tscn b/scenes/components/death_screen.tscn new file mode 100644 index 0000000..2d9907b --- /dev/null +++ b/scenes/components/death_screen.tscn @@ -0,0 +1,234 @@ +[gd_scene format=3 uid="uid://cmalp4tc6asg5"] + +[ext_resource type="Script" uid="uid://ij7vc5allaf7" path="res://scenes/components/death_screen.gd" id="1_sf00y"] +[ext_resource type="Texture2D" uid="uid://dxxsachfb1414" path="res://assets/images/sprites/Player/HURT.png" id="2_t707u"] +[ext_resource type="Texture2D" uid="uid://gselbhwgn87t" path="res://assets/images/sprites/Player/DEATH.png" id="3_y48vm"] +[ext_resource type="FontFile" uid="uid://cqrxu8aj7ih08" path="res://assets/fonts/pixel_font.ttf" id="4_a1ppj"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_1hkis"] +atlas = ExtResource("2_t707u") +region = Rect2(0, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_cjuk3"] +atlas = ExtResource("2_t707u") +region = Rect2(106, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_57bwy"] +atlas = ExtResource("2_t707u") +region = Rect2(212, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pou6f"] +atlas = ExtResource("2_t707u") +region = Rect2(318, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_r6we6"] +atlas = ExtResource("3_y48vm") +region = Rect2(0, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_l0ovk"] +atlas = ExtResource("3_y48vm") +region = Rect2(106, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_2u0eb"] +atlas = ExtResource("3_y48vm") +region = Rect2(212, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5ox82"] +atlas = ExtResource("3_y48vm") +region = Rect2(318, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_bo5pj"] +atlas = ExtResource("3_y48vm") +region = Rect2(424, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_vdnys"] +atlas = ExtResource("3_y48vm") +region = Rect2(530, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_r8nhr"] +atlas = ExtResource("3_y48vm") +region = Rect2(636, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_w7dd3"] +atlas = ExtResource("3_y48vm") +region = Rect2(742, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_e22sg"] +atlas = ExtResource("3_y48vm") +region = Rect2(848, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_w4vwu"] +atlas = ExtResource("3_y48vm") +region = Rect2(954, 0, 106, 84) + +[sub_resource type="SpriteFrames" id="SpriteFrames_uw8iy"] +animations = [{ +"frames": [{ +"duration": 0.4, +"texture": SubResource("AtlasTexture_1hkis") +}, { +"duration": 0.4, +"texture": SubResource("AtlasTexture_cjuk3") +}, { +"duration": 0.4, +"texture": SubResource("AtlasTexture_57bwy") +}, { +"duration": 0.4, +"texture": SubResource("AtlasTexture_pou6f") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_r6we6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_l0ovk") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2u0eb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5ox82") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_bo5pj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_vdnys") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_r8nhr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_w7dd3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_e22sg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_w4vwu") +}], +"loop": 0, +"name": &"player_death", +"speed": 7.0 +}] + +[sub_resource type="LabelSettings" id="LabelSettings_hyhb4"] +font = ExtResource("4_a1ppj") +font_size = 32 +outline_size = 2 +outline_color = Color(0, 0, 0, 1) +shadow_size = 50 + +[sub_resource type="LabelSettings" id="LabelSettings_uvqlf"] +font = ExtResource("4_a1ppj") +outline_size = 1 +outline_color = Color(0, 0, 0, 1) + +[sub_resource type="Theme" id="Theme_uvqlf"] +default_font = ExtResource("4_a1ppj") +default_font_size = 16 + +[sub_resource type="Theme" id="Theme_gy2im"] +default_font = ExtResource("4_a1ppj") +default_font_size = 16 + +[node name="DeathScreen" type="Control" unique_id=530626300] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_sf00y") + +[node name="ColorRect" type="ColorRect" parent="." unique_id=1616720522] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(1, 0, 0, 1) + +[node name="PlayerDeathSprite" type="AnimatedSprite2D" parent="." unique_id=268569770] +position = Vector2(160, 130) +sprite_frames = SubResource("SpriteFrames_uw8iy") +animation = &"player_death" +autoplay = "player_death" +frame = 13 +frame_progress = 1.0 +offset = Vector2(0, -40) + +[node name="Camera2D" type="Camera2D" parent="PlayerDeathSprite" unique_id=2120335197] +offset = Vector2(0, -40) +position_smoothing_enabled = true + +[node name="TextLayer" type="Control" parent="." unique_id=461830828] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="GameOverLabel" type="Label" parent="TextLayer" unique_id=1777638082] +layout_mode = 0 +offset_left = 108.0 +offset_top = 22.0 +offset_right = 212.0 +offset_bottom = 56.0 +text = "GAME OVER" +label_settings = SubResource("LabelSettings_hyhb4") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="VillageDestroyedLabel" type="Label" parent="TextLayer" unique_id=2091854732] +layout_mode = 0 +offset_left = 100.0 +offset_top = 57.0 +offset_right = 221.0 +offset_bottom = 80.0 +text = "Your village is destroyed" +label_settings = SubResource("LabelSettings_uvqlf") + +[node name="OptionsContainer" type="HBoxContainer" parent="." unique_id=1799996589] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -160.0 +offset_top = -35.0 +offset_right = 160.0 +offset_bottom = -10.0 +grow_horizontal = 2 +grow_vertical = 0 +alignment = 1 + +[node name="ContinueButton" type="Button" parent="OptionsContainer" unique_id=1967909358] +layout_mode = 2 +theme = SubResource("Theme_uvqlf") +text = "Continue" +flat = true + +[node name="TitleScreenButton" type="Button" parent="OptionsContainer" unique_id=206299408] +layout_mode = 2 +theme = SubResource("Theme_gy2im") +text = "Title Screen" +flat = true + +[node name="ExitButton" type="Button" parent="OptionsContainer" unique_id=1310023870] +layout_mode = 2 +theme = SubResource("Theme_gy2im") +text = "Exit Game" +flat = true + +[node name="FadeOut" type="ColorRect" parent="." unique_id=925900082] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_bottom = 10.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 0) diff --git a/scenes/components/intro.gd b/scenes/components/intro.gd new file mode 100644 index 0000000..75b5dd7 --- /dev/null +++ b/scenes/components/intro.gd @@ -0,0 +1,46 @@ +class_name Intro +extends Node + +const DIALOGS: Array[String] = [ + "Every few thousands years,", + "an evil entity breaks free", + "from the ancient sacred seal.", + "...", + "The evil is coming back", + "and only you can save us", + "Every one is counting on you", + "...", + "Good luck brave one", +] + +const CHAR_DELAY: float = 0.04 +const LINE_PAUSE: float = 2.0 + +var _full_text: String = "" + +@onready var log_label: RichTextLabel = $CanvasLayer/Label +@onready var background: ColorRect = $CanvasLayer/Background + +func _ready() -> void: + log_label.text = "" + _play_sequence() + +func _play_sequence() -> void: + for line in DIALOGS: + await _type_line(line) + await get_tree().create_timer(LINE_PAUSE).timeout + _full_text += "\n" + + # Fade out + var tween: Tween = create_tween() + tween.tween_property(background, "modulate:a", 0.0, 1.2) + await tween.finished + if OS.get_name() == "Web": + JavaScriptBridge.eval("document.querySelector('canvas').focus()") + SceneManager.change_scene("res://scenes/levels/test_map.tscn") + +func _type_line(line: String) -> void: + for i in line.length(): + _full_text += line[i] + log_label.text = _full_text + await get_tree().create_timer(CHAR_DELAY).timeout diff --git a/scenes/components/intro.gd.uid b/scenes/components/intro.gd.uid new file mode 100644 index 0000000..70b6402 --- /dev/null +++ b/scenes/components/intro.gd.uid @@ -0,0 +1 @@ +uid://dyfyo2hmn3d2n diff --git a/scenes/components/intro.tscn b/scenes/components/intro.tscn new file mode 100644 index 0000000..0aeee59 --- /dev/null +++ b/scenes/components/intro.tscn @@ -0,0 +1,29 @@ +[gd_scene format=3 uid="uid://t1g3j50wteuj"] + +[ext_resource type="Script" uid="uid://dyfyo2hmn3d2n" path="res://scenes/components/intro.gd" id="1_kol6p"] +[ext_resource type="FontFile" uid="uid://cqrxu8aj7ih08" path="res://assets/fonts/pixel_font.ttf" id="2_757ae"] + +[sub_resource type="Theme" id="Theme_kol6p"] +default_font = ExtResource("2_757ae") + +[node name="Intro" type="Node" unique_id=1077364657] +script = ExtResource("1_kol6p") + +[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=335424006] +follow_viewport_enabled = true + +[node name="Background" type="ColorRect" parent="CanvasLayer" unique_id=2005237130] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 1) + +[node name="Label" type="RichTextLabel" parent="CanvasLayer" unique_id=1899603309] +offset_right = 321.0 +offset_bottom = 182.0 +theme = SubResource("Theme_kol6p") +theme_override_colors/font_outline_color = Color(0, 1, 0.4, 1) +horizontal_alignment = 1 +vertical_alignment = 1 diff --git a/scenes/components/title_screen.gd b/scenes/components/title_screen.gd new file mode 100644 index 0000000..9e18606 --- /dev/null +++ b/scenes/components/title_screen.gd @@ -0,0 +1,46 @@ +class_name TitleScreen +extends Control + +@onready var _start_game_button: Button = $Options/StartGameButton +@onready var _options_button: Button = $Options/OptionsButton +@onready var _credits_button: Button = $Options/CreditsButton +@onready var _exit_button: Button = $Options/ExitButton +@onready var _background: ColorRect = $FadeOut + +func _ready() -> void: + _start_game_button.pressed.connect(_on_start_game_pressed) + _options_button.pressed.connect(_on_options_pressed) + _credits_button.pressed.connect(_on_credit_pressed) + _exit_button.pressed.connect(_on_exit_pressed) + _start_game_button.grab_focus() + +func _unhandled_input(event: InputEvent) -> void: + if not event.is_action_pressed("interact"): + return + var viewport: Viewport = get_viewport() + if viewport == null: + return + var focused: Control = viewport.gui_get_focus_owner() + if focused is Button: + (focused as Button).pressed.emit() + viewport.set_input_as_handled() + +func _on_start_game_pressed() -> void: + # Fade out + var tween: Tween = create_tween() + tween.tween_property(_background, "color:a", 1.0, 1.2) + await tween.finished + if OS.get_name() == "Web": + JavaScriptBridge.eval("document.querySelector('canvas').focus()") + + + SceneManager.change_scene("res://scenes/components/intro.tscn") + +func _on_options_pressed() -> void: + print('Options Pressed') + +func _on_credit_pressed() -> void: + print('Credit Pressed') + +func _on_exit_pressed() -> void: + SceneManager.quit_game() diff --git a/scenes/components/title_screen.gd.uid b/scenes/components/title_screen.gd.uid new file mode 100644 index 0000000..00839b4 --- /dev/null +++ b/scenes/components/title_screen.gd.uid @@ -0,0 +1 @@ +uid://d35c6abss7d52 diff --git a/scenes/components/title_screen.tscn b/scenes/components/title_screen.tscn new file mode 100644 index 0000000..7b64e9f --- /dev/null +++ b/scenes/components/title_screen.tscn @@ -0,0 +1,371 @@ +[gd_scene format=4 uid="uid://bpdxv7kv1pvc2"] + +[ext_resource type="Script" uid="uid://d35c6abss7d52" path="res://scenes/components/title_screen.gd" id="1_f0n5y"] +[ext_resource type="TileSet" uid="uid://6ltrd6lvydrw" path="res://ressources/forest_tileset.tres" id="2_2cf7p"] +[ext_resource type="Texture2D" uid="uid://dapligyg1q7vd" path="res://assets/images/sprites/World/Background/Wasteland_Sky.png" id="2_y1amh"] +[ext_resource type="Texture2D" uid="uid://bk41feg0qdi0t" path="res://assets/images/sprites/World/Background/Wasteland_Mountains_1.png" id="3_51c5d"] +[ext_resource type="Texture2D" uid="uid://cdgo042aie21s" path="res://assets/images/sprites/World/Background/Wasteland_Mountains_2.png" id="4_2yr8v"] +[ext_resource type="PackedScene" uid="uid://cwq8mu0hub5qd" path="res://scenes/actors/entity.tscn" id="5_wx5q0"] +[ext_resource type="Texture2D" uid="uid://c6nak38doipjr" path="res://assets/images/sprites/World/Forest/Background/2.png" id="6_03q4f"] +[ext_resource type="Texture2D" uid="uid://caguehadpvpe1" path="res://assets/images/sprites/Player/IDLE.png" id="8_2yr8v"] +[ext_resource type="Texture2D" uid="uid://o7gjt82i1tuy" path="res://assets/images/sprites/World/Forest/Props/RedFlag.png" id="8_wx5q0"] +[ext_resource type="Texture2D" uid="uid://d1mclnyfhlmh8" path="res://assets/images/sprites/World/Forest/Props/Objects.png" id="9_j8yb3"] +[ext_resource type="Texture2D" uid="uid://uxtomds5wl0e" path="res://assets/images/sprites/World/Forest/Props/Props.png" id="10_f0n5y"] +[ext_resource type="FontFile" uid="uid://cqrxu8aj7ih08" path="res://assets/fonts/pixel_font.ttf" id="12_f0n5y"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_ram0d"] +atlas = ExtResource("9_j8yb3") +region = Rect2(0, 0, 32, 96) + +[sub_resource type="AtlasTexture" id="AtlasTexture_s2vmd"] +atlas = ExtResource("8_wx5q0") +region = Rect2(0, 0, 29, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_yovuv"] +atlas = ExtResource("8_wx5q0") +region = Rect2(29, 0, 29, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_imsda"] +atlas = ExtResource("8_wx5q0") +region = Rect2(58, 0, 29, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4n58a"] +atlas = ExtResource("8_wx5q0") +region = Rect2(87, 0, 29, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_id23q"] +atlas = ExtResource("8_wx5q0") +region = Rect2(116, 0, 29, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_31ppy"] +atlas = ExtResource("8_wx5q0") +region = Rect2(145, 0, 29, 64) + +[sub_resource type="SpriteFrames" id="SpriteFrames_uvqlf"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_s2vmd") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_yovuv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_imsda") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4n58a") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_id23q") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_31ppy") +}], +"loop": 1, +"name": &"default", +"speed": 7.0 +}] + +[sub_resource type="AtlasTexture" id="AtlasTexture_hw8k0"] +atlas = ExtResource("10_f0n5y") +region = Rect2(160, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gy2im"] +atlas = ExtResource("10_f0n5y") +region = Rect2(104, 0, 48, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_uvqlf"] +atlas = ExtResource("10_f0n5y") +region = Rect2(0, 0, 64, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wx5q0"] +atlas = ExtResource("8_2yr8v") +region = Rect2(0, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_03q4f"] +atlas = ExtResource("8_2yr8v") +region = Rect2(106, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j8yb3"] +atlas = ExtResource("8_2yr8v") +region = Rect2(212, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_f0n5y"] +atlas = ExtResource("8_2yr8v") +region = Rect2(318, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xaa0h"] +atlas = ExtResource("8_2yr8v") +region = Rect2(424, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6x73w"] +atlas = ExtResource("8_2yr8v") +region = Rect2(530, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_hn6yu"] +atlas = ExtResource("8_2yr8v") +region = Rect2(636, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rjgyo"] +atlas = ExtResource("8_2yr8v") +region = Rect2(742, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_bqiuy"] +atlas = ExtResource("8_2yr8v") +region = Rect2(848, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tky41"] +atlas = ExtResource("8_2yr8v") +region = Rect2(954, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_v0qcs"] +atlas = ExtResource("8_2yr8v") +region = Rect2(1060, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lavtg"] +atlas = ExtResource("8_2yr8v") +region = Rect2(1166, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_r6n1t"] +atlas = ExtResource("8_2yr8v") +region = Rect2(1272, 0, 106, 84) + +[sub_resource type="AtlasTexture" id="AtlasTexture_b5s4q"] +atlas = ExtResource("8_2yr8v") +region = Rect2(1378, 0, 106, 84) + +[sub_resource type="SpriteFrames" id="SpriteFrames_s2vmd"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_wx5q0") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_03q4f") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j8yb3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_f0n5y") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xaa0h") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6x73w") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_hn6yu") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rjgyo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_bqiuy") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tky41") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_v0qcs") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lavtg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_r6n1t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_b5s4q") +}], +"loop": 1, +"name": &"player_idle", +"speed": 10.0 +}] + +[sub_resource type="Theme" id="Theme_uvqlf"] +default_font = ExtResource("12_f0n5y") +default_font_size = 32 + +[sub_resource type="Theme" id="Theme_j8yb3"] +default_font = ExtResource("12_f0n5y") +default_font_size = 16 + +[sub_resource type="Theme" id="Theme_f0n5y"] +default_font = ExtResource("12_f0n5y") +default_font_size = 16 + +[node name="TitleScreen" type="Control" unique_id=2065329278] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_f0n5y") + +[node name="Background" type="Node2D" parent="." unique_id=2091481696] +position = Vector2(-38, -7) + +[node name="WastelandSky" type="Sprite2D" parent="Background" unique_id=1077165735] +position = Vector2(180, 95) +texture = ExtResource("2_y1amh") + +[node name="WastelandMountains1" type="Sprite2D" parent="Background" unique_id=1831855549] +position = Vector2(138, 62) +texture = ExtResource("3_51c5d") + +[node name="Entity" parent="Background" unique_id=286688007 instance=ExtResource("5_wx5q0")] +position = Vector2(306, 102) +scale = Vector2(0.5, 0.5) + +[node name="WastelandMountains2" type="Sprite2D" parent="Background" unique_id=571729154] +position = Vector2(223, 68) +texture = ExtResource("4_2yr8v") + +[node name="2" type="Sprite2D" parent="Background" unique_id=970254118] +position = Vector2(284, 72) +scale = Vector2(1.59375, 1.4333333) +texture = ExtResource("6_03q4f") + +[node name="3" type="Sprite2D" parent="Background" unique_id=247423564] +position = Vector2(-225, 72) +scale = Vector2(1.59375, 1.4333333) +texture = ExtResource("6_03q4f") + +[node name="Sprite2D" type="Sprite2D" parent="Background" unique_id=1700478731] +position = Vector2(152, 116) +texture = SubResource("AtlasTexture_ram0d") + +[node name="Forest2" type="TileMapLayer" parent="Background" unique_id=1996882757] +position = Vector2(16, -31) +tile_map_data = PackedByteArray("AAAFAAYAAQAGAAcAAAAGAAYAAQAHAAcAAAAHAAYAAQAIAAcAAAA=") +tile_set = ExtResource("2_2cf7p") + +[node name="Forest" type="TileMapLayer" parent="Background" unique_id=1144882263] +position = Vector2(16, -31) +tile_map_data = PackedByteArray("AAD//wUAAQACAAYAAAD//wYAAQALAAMAAAAAAAUAAQADAAEAAAAAAAYAAQADAAcAAAAAAAcAAQACAAIAAAABAAYAAQAHAAYAAAABAAcAAQAMAAcAAAACAAYAAQAHAAYAAAACAAcAAQACAAIAAAADAAYAAQAHAAYAAAADAAcAAQAMAAcAAAAEAAYAAQAHAAYAAAAEAAcAAQACAAIAAAAFAAYAAQAHAAYAAAAFAAcAAQAMAAcAAAAGAAYAAQAMAAYAAAAGAAcAAQAHAAcAAAAHAAYAAQAHAAYAAAAHAAcAAQAHAAcAAAAIAAYAAQAHAAYAAAAIAAcAAQAMAAcAAAAJAAYAAQAHAAYAAAAJAAcAAQACAAIAAAAKAAYAAQAHAAYAAAAKAAcAAQAHAAcAAAALAAYAAQAHAAYAAAALAAcAAQAHAAcAAAAMAAYAAQAHAAYAAAAMAAcAAQACAAIAAAAFAAUAAQABAAEAAAAGAAUAAQACAAEAAAAHAAUAAQADAAYAAAA=") +tile_set = ExtResource("2_2cf7p") + +[node name="Flag" type="AnimatedSprite2D" parent="Background" unique_id=1633954144] +position = Vector2(198, 99) +sprite_frames = SubResource("SpriteFrames_uvqlf") +autoplay = "default" + +[node name="Sprite2D2" type="Sprite2D" parent="Background" unique_id=126336721] +position = Vector2(176, 148) +texture = SubResource("AtlasTexture_hw8k0") + +[node name="Sprite2D5" type="Sprite2D" parent="Background" unique_id=1763019285] +position = Vector2(13, 115) +texture = SubResource("AtlasTexture_hw8k0") + +[node name="Sprite2D3" type="Sprite2D" parent="Background" unique_id=1628790302] +position = Vector2(342, 148) +texture = SubResource("AtlasTexture_gy2im") + +[node name="Sprite2D4" type="Sprite2D" parent="Background" unique_id=1974989067] +position = Vector2(265, 148) +texture = SubResource("AtlasTexture_uvqlf") + +[node name="Sprite2D6" type="Sprite2D" parent="Background" unique_id=1793321917] +position = Vector2(102, 149) +texture = SubResource("AtlasTexture_uvqlf") + +[node name="PlayerSprite" type="AnimatedSprite2D" parent="." unique_id=668881275] +position = Vector2(190, 131) +sprite_frames = SubResource("SpriteFrames_s2vmd") +animation = &"player_idle" +autoplay = "player_idle" +offset = Vector2(0, -40) + +[node name="Camera2D" type="Camera2D" parent="PlayerSprite" unique_id=1450340765] +offset = Vector2(-30, -40) +position_smoothing_enabled = true + +[node name="ColorRect" type="ColorRect" parent="." unique_id=1644565373] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_bottom = 10.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 0.34509805) + +[node name="Labels" type="VBoxContainer" parent="." unique_id=825824469] +layout_mode = 1 +offset_left = 5.0 +offset_top = 9.0 +offset_right = 185.0 +offset_bottom = 43.0 + +[node name="Title" type="Label" parent="Labels" unique_id=953099725] +layout_mode = 2 +theme = SubResource("Theme_uvqlf") +theme_override_colors/font_shadow_color = Color(0, 0, 0, 0) +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 1 +theme_override_constants/shadow_outline_size = 50 +text = "OMEN'S ASCENT" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Options" type="VBoxContainer" parent="." unique_id=233978627] +layout_mode = 1 +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_left = 33.0 +offset_top = -40.0 +offset_right = 103.0 +offset_bottom = 60.0 +grow_vertical = 2 +theme_override_constants/separation = 0 +alignment = 1 + +[node name="StartGameButton" type="Button" parent="Options" unique_id=1101105376] +layout_mode = 2 +theme = SubResource("Theme_j8yb3") +text = "Start Game" +flat = true +alignment = 0 +autowrap_trim_flags = 0 + +[node name="OptionsButton" type="Button" parent="Options" unique_id=2105084975] +layout_mode = 2 +theme = SubResource("Theme_f0n5y") +disabled = true +text = "Options" +flat = true +alignment = 0 +autowrap_trim_flags = 0 + +[node name="CreditsButton" type="Button" parent="Options" unique_id=2065644118] +layout_mode = 2 +theme = SubResource("Theme_f0n5y") +disabled = true +text = "Credits" +flat = true +alignment = 0 +autowrap_trim_flags = 0 + +[node name="ExitButton" type="Button" parent="Options" unique_id=1625788708] +layout_mode = 2 +theme = SubResource("Theme_f0n5y") +text = "Exit Game" +flat = true +alignment = 0 +autowrap_trim_flags = 0 + +[node name="FadeOut" type="ColorRect" parent="." unique_id=1118634476] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_bottom = 10.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 0) diff --git a/scenes/ui/heart.gd b/scenes/ui/heart.gd new file mode 100644 index 0000000..d844f27 --- /dev/null +++ b/scenes/ui/heart.gd @@ -0,0 +1,16 @@ +class_name Heart +extends TextureRect + +@export var full_heart: Texture2D +@export var three_quarter_heart: Texture2D +@export var half_heart: Texture2D +@export var quarter_heart: Texture2D +@export var empty_heart: Texture2D + +func set_value(value: int) -> void: + match value: + 4: texture = full_heart + 3: texture = three_quarter_heart + 2: texture = half_heart + 1: texture = quarter_heart + 0: texture = empty_heart diff --git a/scenes/ui/heart.gd.uid b/scenes/ui/heart.gd.uid new file mode 100644 index 0000000..97c67b0 --- /dev/null +++ b/scenes/ui/heart.gd.uid @@ -0,0 +1 @@ +uid://blmronsa4by7t diff --git a/scenes/ui/heart.tscn b/scenes/ui/heart.tscn new file mode 100644 index 0000000..82418be --- /dev/null +++ b/scenes/ui/heart.tscn @@ -0,0 +1,32 @@ +[gd_scene format=3 uid="uid://2jpyobrrjgut"] + +[ext_resource type="Script" uid="uid://blmronsa4by7t" path="res://scenes/ui/heart.gd" id="1_gwnj5"] +[ext_resource type="Texture2D" uid="uid://d21exomvahd34" path="res://assets/images/ui/Heart.png" id="2_rlach"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_uvqlf"] +atlas = ExtResource("2_rlach") +region = Rect2(64, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gy2im"] +atlas = ExtResource("2_rlach") +region = Rect2(48, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_hw8k0"] +atlas = ExtResource("2_rlach") +region = Rect2(32, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ram0d"] +atlas = ExtResource("2_rlach") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_r2fnt"] +atlas = ExtResource("2_rlach") +region = Rect2(0, 0, 16, 16) + +[node name="Heart" type="TextureRect" unique_id=474807257] +script = ExtResource("1_gwnj5") +full_heart = SubResource("AtlasTexture_uvqlf") +three_quarter_heart = SubResource("AtlasTexture_gy2im") +half_heart = SubResource("AtlasTexture_hw8k0") +quarter_heart = SubResource("AtlasTexture_ram0d") +empty_heart = SubResource("AtlasTexture_r2fnt") diff --git a/scenes/ui/player_hud.gd b/scenes/ui/player_hud.gd new file mode 100644 index 0000000..4955173 --- /dev/null +++ b/scenes/ui/player_hud.gd @@ -0,0 +1,31 @@ +class_name PlayerHUD +extends CanvasLayer + +const HEART_SCENE: PackedScene = preload("res://scenes/ui/heart.tscn") +const HEALTH_PER_HEART: int = 4 + +@onready var _hearts_container: HBoxContainer = $MarginContainer/HeartsContainer + +var _hearts: Array[Heart] = [] + +func _ready() -> void: + EventBus.player_health_changed.connect(_on_player_health_changed) + +func _on_player_health_changed(current_health: int, max_health: int) -> void: + var heart_count: int = ceili(float(max_health) / HEALTH_PER_HEART) + if heart_count != _hearts.size(): + _build_hearts(heart_count) + + for i in _hearts.size(): + var remaining: int = clampi(current_health - i * HEALTH_PER_HEART, 0, HEALTH_PER_HEART) + _hearts[i].set_value(remaining) + +func _build_hearts(heart_count: int) -> void: + for heart in _hearts: + heart.queue_free() + _hearts.clear() + + for i in heart_count: + var heart: Heart = HEART_SCENE.instantiate() + _hearts_container.add_child(heart) + _hearts.append(heart) diff --git a/scenes/ui/player_hud.gd.uid b/scenes/ui/player_hud.gd.uid new file mode 100644 index 0000000..3c21e2f --- /dev/null +++ b/scenes/ui/player_hud.gd.uid @@ -0,0 +1 @@ +uid://tpvkmorh4l0h diff --git a/scenes/ui/player_hud.tscn b/scenes/ui/player_hud.tscn new file mode 100644 index 0000000..c87f8f2 --- /dev/null +++ b/scenes/ui/player_hud.tscn @@ -0,0 +1,15 @@ +[gd_scene format=3 uid="uid://3bhkncvwd7fa"] + +[ext_resource type="Script" uid="uid://tpvkmorh4l0h" path="res://scenes/ui/player_hud.gd" id="1_e6e0b"] + +[node name="HUD" type="CanvasLayer" unique_id=409721474] +script = ExtResource("1_e6e0b") + +[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1834189152] +offset_left = 8.0 +offset_top = 3.0 +offset_right = 8.0 +offset_bottom = 3.0 + +[node name="HeartsContainer" type="HBoxContainer" parent="MarginContainer" unique_id=315711027] +layout_mode = 2