From a24a4e140312332b7a819eabd2f94a86bccf0a76 Mon Sep 17 00:00:00 2001 From: Raxki Date: Mon, 23 Sep 2024 20:39:50 -0400 Subject: [PATCH] Add placeholder UI and NPCs --- .gitattributes | 1 + Hiro/testportrait.png | 3 + Hiro/testportrait.png.import | 34 ++++++++++++ NPCs/npc1.png | 3 + NPCs/npc1.png.import | 34 ++++++++++++ NPCs/npc2.png | 3 + NPCs/npc2.png.import | 34 ++++++++++++ NPCs/npc3.png | 3 + NPCs/npc3.png.import | 34 ++++++++++++ NPCs/npc4.png | 3 + NPCs/npc4.png.import | 34 ++++++++++++ NPCs/npc5.png | 3 + NPCs/npc5.png.import | 34 ++++++++++++ NPCs/npc6.png | 3 + NPCs/npc6.png.import | 34 ++++++++++++ Scripts/Levels/arena_level.gd | 6 ++ Scripts/hiro_ai.gd | 5 +- Scripts/hiro_player.gd | 2 + Scripts/ui.gd | 20 +++++++ UI/Gundam 00 font gaufont.ttf | 3 + UI/Gundam 00 font gaufont.ttf.import | 33 +++++++++++ UI/battle_ui.tscn | 56 +++++++++++++++++++ UI/textbox_ui.tscn | 83 ++++++++++++++++++++++++++++ project.godot | 3 + world/world.tscn | 70 ++++++++++++++++++++--- 25 files changed, 529 insertions(+), 12 deletions(-) create mode 100644 Hiro/testportrait.png create mode 100644 Hiro/testportrait.png.import create mode 100644 NPCs/npc1.png create mode 100644 NPCs/npc1.png.import create mode 100644 NPCs/npc2.png create mode 100644 NPCs/npc2.png.import create mode 100644 NPCs/npc3.png create mode 100644 NPCs/npc3.png.import create mode 100644 NPCs/npc4.png create mode 100644 NPCs/npc4.png.import create mode 100644 NPCs/npc5.png create mode 100644 NPCs/npc5.png.import create mode 100644 NPCs/npc6.png create mode 100644 NPCs/npc6.png.import create mode 100644 Scripts/ui.gd create mode 100644 UI/Gundam 00 font gaufont.ttf create mode 100644 UI/Gundam 00 font gaufont.ttf.import create mode 100644 UI/battle_ui.tscn create mode 100644 UI/textbox_ui.tscn diff --git a/.gitattributes b/.gitattributes index e945f53..94aefeb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ # Normalize EOL for all files that Git considers text files. * text=auto eol=lf *.png filter=lfs diff=lfs merge=lfs -text lockable +*.[tT][tT][fF] filter=lfs diff=lfs merge=lfs -text lockable diff --git a/Hiro/testportrait.png b/Hiro/testportrait.png new file mode 100644 index 0000000..25f5445 --- /dev/null +++ b/Hiro/testportrait.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a1318f794cacea99b3c083c7d1c213e8995ac2a0c3df327e9876b61e38a2b8f +size 119551 diff --git a/Hiro/testportrait.png.import b/Hiro/testportrait.png.import new file mode 100644 index 0000000..96d250a --- /dev/null +++ b/Hiro/testportrait.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b7opep16uyb5r" +path="res://.godot/imported/testportrait.png-e1400284f87756f31d41c6af9ee920bd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Hiro/testportrait.png" +dest_files=["res://.godot/imported/testportrait.png-e1400284f87756f31d41c6af9ee920bd.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/NPCs/npc1.png b/NPCs/npc1.png new file mode 100644 index 0000000..addf990 --- /dev/null +++ b/NPCs/npc1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8813c1e321943c2fdcb0013fe93f219c714b5e03b8967c77530cc9fa624b6ca8 +size 406 diff --git a/NPCs/npc1.png.import b/NPCs/npc1.png.import new file mode 100644 index 0000000..e2ec543 --- /dev/null +++ b/NPCs/npc1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b7l1k8j3ie4qi" +path="res://.godot/imported/npc1.png-c12382b3e509a49cad820e835f37ea66.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://NPCs/npc1.png" +dest_files=["res://.godot/imported/npc1.png-c12382b3e509a49cad820e835f37ea66.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/NPCs/npc2.png b/NPCs/npc2.png new file mode 100644 index 0000000..6deea10 --- /dev/null +++ b/NPCs/npc2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da8f4ccb120760a3e6d3b40970e13ed685055224bc50c8081df2aba4bfb90c56 +size 415 diff --git a/NPCs/npc2.png.import b/NPCs/npc2.png.import new file mode 100644 index 0000000..2c69696 --- /dev/null +++ b/NPCs/npc2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dym70eidamyel" +path="res://.godot/imported/npc2.png-1d6b97c8d94e4345f9dea4b7a42e43f2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://NPCs/npc2.png" +dest_files=["res://.godot/imported/npc2.png-1d6b97c8d94e4345f9dea4b7a42e43f2.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/NPCs/npc3.png b/NPCs/npc3.png new file mode 100644 index 0000000..484d917 --- /dev/null +++ b/NPCs/npc3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25c1d999395ac503abb35fcb99531ecb6b7fcaa027118935d43a735471841123 +size 405 diff --git a/NPCs/npc3.png.import b/NPCs/npc3.png.import new file mode 100644 index 0000000..02af358 --- /dev/null +++ b/NPCs/npc3.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://y31qyw51y7hb" +path="res://.godot/imported/npc3.png-489c2fd33a0b3bdb7286bcbe4b1ed528.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://NPCs/npc3.png" +dest_files=["res://.godot/imported/npc3.png-489c2fd33a0b3bdb7286bcbe4b1ed528.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/NPCs/npc4.png b/NPCs/npc4.png new file mode 100644 index 0000000..93be662 --- /dev/null +++ b/NPCs/npc4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2def9aa43c466ab7e75e4ffa10eab8881e7fcc76ac458993c4f395ca3cf7a33 +size 415 diff --git a/NPCs/npc4.png.import b/NPCs/npc4.png.import new file mode 100644 index 0000000..481f721 --- /dev/null +++ b/NPCs/npc4.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://jnub86bpiebw" +path="res://.godot/imported/npc4.png-69b0a5d764f3a3f6b53a1fedb26fef98.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://NPCs/npc4.png" +dest_files=["res://.godot/imported/npc4.png-69b0a5d764f3a3f6b53a1fedb26fef98.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/NPCs/npc5.png b/NPCs/npc5.png new file mode 100644 index 0000000..25714e4 --- /dev/null +++ b/NPCs/npc5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7e2466b00744ab511495a701a0989ea05d3dc8163ad8d55e22952893edc1aa2 +size 409 diff --git a/NPCs/npc5.png.import b/NPCs/npc5.png.import new file mode 100644 index 0000000..d3479c1 --- /dev/null +++ b/NPCs/npc5.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://baw6gijyxv1fv" +path="res://.godot/imported/npc5.png-e3bfbfb64b447d6714d910daed2c76ca.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://NPCs/npc5.png" +dest_files=["res://.godot/imported/npc5.png-e3bfbfb64b447d6714d910daed2c76ca.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/NPCs/npc6.png b/NPCs/npc6.png new file mode 100644 index 0000000..6d90d21 --- /dev/null +++ b/NPCs/npc6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8e3a22cf45cd8c65a1adb546276b8210702e8725b3a1705a8407581f61fe8e2 +size 409 diff --git a/NPCs/npc6.png.import b/NPCs/npc6.png.import new file mode 100644 index 0000000..d7c4b1c --- /dev/null +++ b/NPCs/npc6.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bcvxfjlg8mmjr" +path="res://.godot/imported/npc6.png-7db9eb6b21cae9935570f7fc4d011824.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://NPCs/npc6.png" +dest_files=["res://.godot/imported/npc6.png-7db9eb6b21cae9935570f7fc4d011824.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/Scripts/Levels/arena_level.gd b/Scripts/Levels/arena_level.gd index f2f0081..59a6282 100644 --- a/Scripts/Levels/arena_level.gd +++ b/Scripts/Levels/arena_level.gd @@ -1,9 +1,15 @@ extends Node2D @onready var explosion_generator = $ExplosionGenerator +@onready var battle_ui = $CanvasLayer/BattleUI @onready var player = $HiroPlayer @onready var ai = $HiroAI +func _ready(): + battle_ui.initialize(player.health, ai.health) + battle_ui.set_player_health(player.health) + battle_ui.set_enemy_health(ai.health) + func _on_player_defeated(): if Globals.nsfw == true: explosion_generator.spawn(player.position) diff --git a/Scripts/hiro_ai.gd b/Scripts/hiro_ai.gd index 38ef024..0963959 100644 --- a/Scripts/hiro_ai.gd +++ b/Scripts/hiro_ai.gd @@ -23,7 +23,7 @@ var attack_counter_limit = 0 var wants_to_melee = false -signal _got_hurt(damage: int, attack_direction: Vector2) +signal got_hurt(new_health: int) signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2) signal defeated @@ -49,7 +49,6 @@ func _physics_process(_delta): func _on_player_attack_did_hit(other, attack_power: int, attack_direction: Vector2): if other.get_parent().get_instance_id() == get_instance_id() : _on_ai_got_hurt(attack_power, attack_direction) - _got_hurt.emit(attack_power, attack_direction) func _on_ai_got_hurt(attack_power: int, attack_direction: Vector2): attacked_from = attack_direction @@ -82,7 +81,7 @@ func _on_hurt_state_entered(): var facing_direction = attacked_from * -1 health = health - received_damage hit_counter = hit_counter + 1 - + got_hurt.emit(health) # 1. If hit_counter variable >= 4, then you need to make the state_machine # # 1.1 send an event "will_reposition" diff --git a/Scripts/hiro_player.gd b/Scripts/hiro_player.gd index 1997451..652aa4d 100644 --- a/Scripts/hiro_player.gd +++ b/Scripts/hiro_player.gd @@ -13,6 +13,7 @@ var can_move = true @onready var animation_playback: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback") signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2) +signal got_hurt(new_health: int) signal defeated func _unhandled_input(event): @@ -97,6 +98,7 @@ func _on_enemy_attack_did_hit(other, power, attack_direction): velocity = KNOCKBACK_POWER * knockback_direction.normalized() animation_playback.travel("hurt") $AnimationTree.set("parameters/conditions/melee", false) + got_hurt.emit(health) func _on_animation_tree_animation_finished(anim_name): if anim_name.contains("hurt") or anim_name.contains("kick") or anim_name.contains("punch"): diff --git a/Scripts/ui.gd b/Scripts/ui.gd new file mode 100644 index 0000000..c74adcd --- /dev/null +++ b/Scripts/ui.gd @@ -0,0 +1,20 @@ +extends Control + +@onready var player_health_bar: ProgressBar = $MarginContainer/HBoxContainer/HealthBar +@onready var enemy_health_bar: ProgressBar = $MarginContainer/HBoxContainer/EnemyBar + +func initialize(player_max_health: int, enemy_max_health: int): + player_health_bar.max_value = player_max_health + enemy_health_bar.max_value = enemy_max_health + +func set_player_health(value: int): + player_health_bar.value = value + +func set_enemy_health(value: int): + enemy_health_bar.value = value + +func _on_player_got_hurt(new_health: int): + set_player_health(new_health) + +func _on_enemy_got_hurt(new_health: int): + set_enemy_health(new_health) diff --git a/UI/Gundam 00 font gaufont.ttf b/UI/Gundam 00 font gaufont.ttf new file mode 100644 index 0000000..91647bf --- /dev/null +++ b/UI/Gundam 00 font gaufont.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7849cfdc70938c316c0e57d8951aeb7bed4bf68e32aa31c9aa3df867d8a2d0ab +size 19868 diff --git a/UI/Gundam 00 font gaufont.ttf.import b/UI/Gundam 00 font gaufont.ttf.import new file mode 100644 index 0000000..8134dbb --- /dev/null +++ b/UI/Gundam 00 font gaufont.ttf.import @@ -0,0 +1,33 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://bgqotudi6bifk" +path="res://.godot/imported/Gundam 00 font gaufont.ttf-1ecd6928ea06702c878a588c4fcb6b99.fontdata" + +[deps] + +source_file="res://UI/Gundam 00 font gaufont.ttf" +dest_files=["res://.godot/imported/Gundam 00 font gaufont.ttf-1ecd6928ea06702c878a588c4fcb6b99.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/UI/battle_ui.tscn b/UI/battle_ui.tscn new file mode 100644 index 0000000..021c0c6 --- /dev/null +++ b/UI/battle_ui.tscn @@ -0,0 +1,56 @@ +[gd_scene load_steps=4 format=3 uid="uid://ce2tjyxwaar01"] + +[ext_resource type="Script" path="res://Scripts/ui.gd" id="1_pbo7d"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3rm2j"] +bg_color = Color(0.12549, 0.72549, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_688ss"] +bg_color = Color(1, 0.25098, 0.262745, 1) + +[node name="UI" 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_pbo7d") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 32.0 +grow_horizontal = 2 +theme_override_constants/margin_left = 16 +theme_override_constants/margin_top = 16 +theme_override_constants/margin_right = 16 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] +custom_minimum_size = Vector2(0, 16) +layout_mode = 2 + +[node name="HealthBar" type="ProgressBar" parent="MarginContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 2.0 +theme_override_styles/fill = SubResource("StyleBoxFlat_3rm2j") +step = 1.0 +value = 50.0 +show_percentage = false + +[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="EnemyBar" type="ProgressBar" parent="MarginContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 2.0 +theme_override_styles/fill = SubResource("StyleBoxFlat_688ss") +step = 1.0 +value = 13.0 +show_percentage = false diff --git a/UI/textbox_ui.tscn b/UI/textbox_ui.tscn new file mode 100644 index 0000000..0ca1b01 --- /dev/null +++ b/UI/textbox_ui.tscn @@ -0,0 +1,83 @@ +[gd_scene load_steps=4 format=3 uid="uid://7oi3hcf5q4o7"] + +[ext_resource type="FontFile" uid="uid://bgqotudi6bifk" path="res://UI/Gundam 00 font gaufont.ttf" id="1_p6ypw"] +[ext_resource type="Texture2D" uid="uid://b7opep16uyb5r" path="res://Hiro/testportrait.png" id="2_6wmjm"] + +[sub_resource type="LabelSettings" id="LabelSettings_ydgvr"] +font = ExtResource("1_p6ypw") +font_size = 18 + +[node name="TextboxUI" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="ChatboxContainer" type="Control" parent="."] +layout_mode = 1 +anchor_top = 0.55 +anchor_right = 1.0 +anchor_bottom = 0.95 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="Chatbox" type="PanelContainer" parent="ChatboxContainer"] +layout_mode = 1 +anchors_preset = -1 +anchor_top = 0.358 +anchor_right = 0.9 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 + +[node name="PlacementContainer" type="Control" parent="ChatboxContainer/Chatbox"] +layout_mode = 2 + +[node name="NextIndicator" type="Label" parent="ChatboxContainer/Chatbox/PlacementContainer"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = -16.0 +offset_bottom = -16.0 +grow_horizontal = 0 +grow_vertical = 0 +text = ">" +label_settings = SubResource("LabelSettings_ydgvr") + +[node name="MarginContainer" type="MarginContainer" parent="ChatboxContainer/Chatbox/PlacementContainer"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.269 +anchor_right = 0.919 +anchor_bottom = 1.0 +grow_vertical = 2 +size_flags_horizontal = 0 +theme_override_constants/margin_left = 16 +theme_override_constants/margin_top = 16 +theme_override_constants/margin_right = 16 +theme_override_constants/margin_bottom = 16 + +[node name="Text" type="Label" parent="ChatboxContainer/Chatbox/PlacementContainer/MarginContainer"] +custom_minimum_size = Vector2(100, 0) +layout_mode = 2 +size_flags_vertical = 1 +text = "Hello my name is Hiro Toyama, you destroyed my gunpla. Now I'm going to kill you." +label_settings = SubResource("LabelSettings_ydgvr") +autowrap_mode = 2 +text_overrun_behavior = 3 + +[node name="Portrait" type="TextureRect" parent="ChatboxContainer"] +layout_mode = 1 +anchors_preset = -1 +anchor_right = 0.286 +anchor_bottom = 1.0 +grow_vertical = 0 +texture = ExtResource("2_6wmjm") +expand_mode = 1 +stretch_mode = 5 diff --git a/project.godot b/project.godot index 71ec32e..dde36ba 100644 --- a/project.godot +++ b/project.godot @@ -21,6 +21,8 @@ Globals="*res://Scripts/globals.gd" [display] +window/size/viewport_width=720 +window/size/viewport_height=480 window/stretch/mode="viewport" [editor] @@ -104,3 +106,4 @@ melee={ [rendering] renderer/rendering_method="mobile" +2d/snap/snap_2d_transforms_to_pixel=true diff --git a/world/world.tscn b/world/world.tscn index 5d35fcb..ba3593e 100644 --- a/world/world.tscn +++ b/world/world.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://bxuxjqxxqy7ce"] +[gd_scene load_steps=21 format=3 uid="uid://bxuxjqxxqy7ce"] [ext_resource type="PackedScene" uid="uid://di21xheryhp0k" path="res://Hiro/hiro_player.tscn" id="1_c1gpq"] [ext_resource type="PackedScene" uid="uid://b8sfype1vx5ad" path="res://Nem/nem_npc.tscn" id="1_sqt7d"] @@ -10,6 +10,14 @@ [ext_resource type="Texture2D" uid="uid://dc12iaho4b8yl" path="res://world/walls.png" id="7_pp5dn"] [ext_resource type="PackedScene" uid="uid://c503u0i421w34" path="res://world/pillar.tscn" id="8_mxq55"] [ext_resource type="Script" path="res://Scripts/explosion_generator.gd" id="9_df2wo"] +[ext_resource type="PackedScene" uid="uid://ce2tjyxwaar01" path="res://UI/battle_ui.tscn" id="10_hxn8m"] +[ext_resource type="Texture2D" uid="uid://b7l1k8j3ie4qi" path="res://NPCs/npc1.png" id="11_p77ah"] +[ext_resource type="PackedScene" uid="uid://7oi3hcf5q4o7" path="res://UI/textbox_ui.tscn" id="12_8pgvx"] +[ext_resource type="Texture2D" uid="uid://dym70eidamyel" path="res://NPCs/npc2.png" id="12_mlj32"] +[ext_resource type="Texture2D" uid="uid://y31qyw51y7hb" path="res://NPCs/npc3.png" id="13_6g4gt"] +[ext_resource type="Texture2D" uid="uid://jnub86bpiebw" path="res://NPCs/npc4.png" id="14_46hs3"] +[ext_resource type="Texture2D" uid="uid://baw6gijyxv1fv" path="res://NPCs/npc5.png" id="15_ppm1i"] +[ext_resource type="Texture2D" uid="uid://bcvxfjlg8mmjr" path="res://NPCs/npc6.png" id="16_cgyrp"] [sub_resource type="Gradient" id="Gradient_3ox2i"] colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1) @@ -27,10 +35,9 @@ position = Vector2(-136, -190) [node name="Sprite2D" type="Sprite2D" parent="MapElements"] z_index = -12 -position = Vector2(85.5, 165.625) +position = Vector2(147, 432) scale = Vector2(3.89453, 652.75) texture = SubResource("GradientTexture1D_4uhai") -metadata/_edit_lock_ = true [node name="FightingDojoBg" type="Sprite2D" parent="MapElements"] z_index = -5 @@ -78,12 +85,13 @@ texture = ExtResource("7_pp5dn") [node name="HiroPlayer" parent="." instance=ExtResource("1_c1gpq")] position = Vector2(-44, -12) -speed = 80 +speed = 70 [node name="Camera2D" type="Camera2D" parent="HiroPlayer"] texture_filter = 1 offset = Vector2(0, -12) -zoom = Vector2(3, 3) +zoom = Vector2(2, 2) +position_smoothing_enabled = true position_smoothing_speed = 3.0 [node name="ReedPlayer" parent="." instance=ExtResource("6_cn8e2")] @@ -101,20 +109,26 @@ collision_mask = 17 [node name="Floor Collission" type="CollisionPolygon2D" parent="BG Collissions"] position = Vector2(-1341, -243) scale = Vector2(8.83789, 4.22585) -polygon = PackedVector2Array(157.843, 76.9076, 161.464, 75.961, 172.213, 75.7244, 176.513, 76.9076, 179.22, 82.4429, 180.012, 85.7558, 180.36, 93.9456, 180.247, 114.06, 179.341, 117.373, 177.871, 119.739, 174.929, 120.922, 169.497, 120.922, 169.497, 123.525, 164.745, 123.525, 164.632, 120.922, 159.201, 120.922, 156.372, 120.213, 154.901, 117.373, 154.109, 114.533, 153.883, 94.4189, 153.883, 84.0068, 152.186, 83.0602, 152.412, 80.9304, 146.181, 70.3743, 139.513, 85.4266, 135.779, 90.8692, 147.66, 124.945, 187.367, 125.038, 195.514, 91.4351, 192.232, 66.1148, 173.676, 53.3363, 157.382, 53.8096, 152.404, 63.2751, 153.317, 81.6403, 153.883, 84.0068, 155.92, 79.9839) +polygon = PackedVector2Array(158.522, 76.9076, 161.916, 75.961, 172.213, 75.961, 175.834, 76.671, 177.757, 78.5641, 179.341, 82.8236, 180.134, 85.8999, 180.134, 93.9456, 180.134, 114.06, 179.341, 117.373, 177.871, 119.739, 174.929, 120.922, 169.497, 120.922, 169.497, 123.525, 164.745, 123.525, 164.632, 120.922, 159.201, 120.922, 156.372, 120.213, 154.901, 117.373, 154.109, 113.587, 154.109, 94.1822, 154.109, 86.1365, 152.186, 83.0602, 152.412, 80.9304, 146.181, 70.3743, 139.513, 85.4266, 135.779, 90.8692, 147.66, 124.945, 187.367, 125.038, 195.514, 91.4351, 192.232, 66.1148, 173.676, 53.3363, 157.382, 53.8096, 152.404, 63.2751, 153.317, 81.6403, 154.109, 85.8999, 154.901, 83.2969, 156.485, 78.5641) [node name="HiroAI" parent="." node_paths=PackedStringArray("player_character") instance=ExtResource("5_r7nw4")] position = Vector2(-1, 25) player_character = NodePath("../HiroPlayer") -health = 250 +health = 400 attack_power = 10 +KNOCKBACK_POWER = 60 +KNOCKBACK_REPOSITION_POWER = 90 +MELEE_RADIUS = 300 [node name="ExplosionGenerator" type="Node" parent="."] script = ExtResource("9_df2wo") [node name="CanvasLayer" type="CanvasLayer" parent="."] -[node name="Container" type="Control" parent="CanvasLayer"] +[node name="BattleUI" parent="CanvasLayer" instance=ExtResource("10_hxn8m")] + +[node name="Debug" type="Control" parent="CanvasLayer"] +visible = false layout_mode = 3 anchor_left = 0.667 anchor_right = 1.0 @@ -122,13 +136,51 @@ anchor_bottom = 1.0 grow_horizontal = 0 grow_vertical = 2 -[node name="StateChartDebugger" parent="CanvasLayer/Container" instance=ExtResource("2_o5str")] +[node name="StateChartDebugger" parent="CanvasLayer/Debug" instance=ExtResource("2_o5str")] layout_mode = 1 size_flags_horizontal = 0 +enabled = false initial_node_to_watch = NodePath("../../../HiroAI") +[node name="TextboxUI" parent="CanvasLayer" instance=ExtResource("12_8pgvx")] + +[node name="NPCs" type="Node2D" parent="."] +visible = false + +[node name="Npc1" type="Sprite2D" parent="NPCs"] +texture_filter = 1 +position = Vector2(231, -83) +texture = ExtResource("11_p77ah") + +[node name="Npc2" type="Sprite2D" parent="NPCs"] +texture_filter = 1 +position = Vector2(251, -101) +texture = ExtResource("12_mlj32") + +[node name="Npc3" type="Sprite2D" parent="NPCs"] +texture_filter = 1 +position = Vector2(360, -87) +texture = ExtResource("13_6g4gt") + +[node name="Npc4" type="Sprite2D" parent="NPCs"] +texture_filter = 1 +position = Vector2(379, -92) +texture = ExtResource("14_46hs3") + +[node name="Npc5" type="Sprite2D" parent="NPCs"] +texture_filter = 1 +position = Vector2(328, -95) +texture = ExtResource("15_ppm1i") + +[node name="Npc6" type="Sprite2D" parent="NPCs"] +texture_filter = 1 +position = Vector2(285, -102) +texture = ExtResource("16_cgyrp") + [connection signal="attack_did_hit" from="HiroPlayer" to="HiroAI" method="_on_player_attack_did_hit"] [connection signal="defeated" from="HiroPlayer" to="." method="_on_player_defeated"] [connection signal="defeated" from="HiroPlayer" to="HiroAI" method="_on_player_been_defeated"] +[connection signal="got_hurt" from="HiroPlayer" to="CanvasLayer/BattleUI" method="_on_player_got_hurt"] [connection signal="attack_did_hit" from="HiroAI" to="HiroPlayer" method="_on_enemy_attack_did_hit"] [connection signal="defeated" from="HiroAI" to="." method="_on_ai_defeated"] +[connection signal="got_hurt" from="HiroAI" to="CanvasLayer/BattleUI" method="_on_enemy_got_hurt"]