diff --git a/config/character/bullet01.tres b/config/character/bullet01.tres index 0a651be..9847329 100644 --- a/config/character/bullet01.tres +++ b/config/character/bullet01.tres @@ -12,7 +12,7 @@ script = ExtResource("3_p63bn") name = "hero01" type = 2 -sprite_harf_height = 26 +sprite_height = 26 sprite_width = 16 move = ExtResource("3_gqffj") shield = ExtResource("4_qnn3b") diff --git a/config/character/hero01.tres b/config/character/hero01.tres index 37db938..74a45ea 100644 --- a/config/character/hero01.tres +++ b/config/character/hero01.tres @@ -10,9 +10,9 @@ [resource] script = ExtResource("1_2054l") name = "hero01" -type = null +type = 0 sprite_frames = ExtResource("2_cssb0") -sprite_harf_height = 26 +sprite_height = 50 sprite_width = 16 move = ExtResource("1_ebj0w") shield = ExtResource("3_5l0vx") diff --git a/config/character/monster01.tres b/config/character/monster01.tres index 107f65b..828a5d2 100644 --- a/config/character/monster01.tres +++ b/config/character/monster01.tres @@ -1,10 +1,10 @@ [gd_resource type="Resource" script_class="CharacterCfg" load_steps=7 format=3 uid="uid://b1gf2jimihmc7"] [ext_resource type="Script" path="res://script/config/character_cfg.gd" id="1_4orbu"] -[ext_resource type="Resource" uid="uid://dx54fjf5t0uu8" path="res://config/character_move/normal.tres" id="1_b0lkj"] +[ext_resource type="Resource" uid="uid://dkjv5kj8mgy8v" path="res://config/character_move/slow.tres" id="1_vaqv0"] [ext_resource type="Resource" uid="uid://dpajmgrlaytah" path="res://config/character_mp/normal.tres" id="2_pl54c"] [ext_resource type="SpriteFrames" uid="uid://dkljs5h8gj5l" path="res://resource/animation/character/monster01_move.aseprite" id="2_su3hg"] -[ext_resource type="Resource" uid="uid://dlaekoamystx3" path="res://config/character_shield/normal.tres" id="3_3nfrx"] +[ext_resource type="Resource" uid="uid://h1curvk64vm3" path="res://config/character_shield/none.tres" id="4_ei6r7"] [ext_resource type="Resource" uid="uid://cac6mk6g078vn" path="res://config/character_stun/normal.tres" id="6_25uqm"] [resource] @@ -12,10 +12,10 @@ script = ExtResource("1_4orbu") name = "monster01" type = 1 sprite_frames = ExtResource("2_su3hg") -sprite_harf_height = 10 -sprite_width = 16 -move = ExtResource("1_b0lkj") -shield = ExtResource("3_3nfrx") +sprite_height = 20 +sprite_width = 14 +move = ExtResource("1_vaqv0") +shield = ExtResource("4_ei6r7") stun = ExtResource("6_25uqm") mp = ExtResource("2_pl54c") hp_max = 20.0 diff --git a/config/character/monster02.tres b/config/character/monster02.tres index 1a0b7c6..d18f67b 100644 --- a/config/character/monster02.tres +++ b/config/character/monster02.tres @@ -1,6 +1,6 @@ [gd_resource type="Resource" script_class="CharacterCfg" load_steps=7 format=3 uid="uid://dmfh54jffhx28"] -[ext_resource type="Resource" uid="uid://dx54fjf5t0uu8" path="res://config/character_move/normal.tres" id="1_hjl2t"] +[ext_resource type="Resource" uid="uid://dkjv5kj8mgy8v" path="res://config/character_move/slow.tres" id="1_tsstu"] [ext_resource type="Script" path="res://script/config/character_cfg.gd" id="1_wkjce"] [ext_resource type="Resource" uid="uid://dpajmgrlaytah" path="res://config/character_mp/normal.tres" id="2_gly3h"] [ext_resource type="SpriteFrames" uid="uid://crdd52skym3ir" path="res://resource/animation/character/monster02_move.aseprite" id="2_h60bf"] @@ -12,9 +12,9 @@ script = ExtResource("1_wkjce") name = "monster02" type = 1 sprite_frames = ExtResource("2_h60bf") -sprite_harf_height = 26 -sprite_width = 16 -move = ExtResource("1_hjl2t") +sprite_height = 42 +sprite_width = 15 +move = ExtResource("1_tsstu") shield = ExtResource("4_uyg17") stun = ExtResource("6_vlmkd") mp = ExtResource("2_gly3h") diff --git a/config/character/monster03.tres b/config/character/monster03.tres index 60f38bb..844f70d 100644 --- a/config/character/monster03.tres +++ b/config/character/monster03.tres @@ -12,7 +12,7 @@ script = ExtResource("3_0gem5") name = "monster02" type = 1 sprite_frames = ExtResource("5_4dnud") -sprite_harf_height = 26 +sprite_height = 45 sprite_width = 16 move = ExtResource("1_ol2gy") shield = ExtResource("4_3daai") diff --git a/config/character_move/slow.tres b/config/character_move/slow.tres new file mode 100644 index 0000000..b52ff6b --- /dev/null +++ b/config/character_move/slow.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="CharacterMoveCfg" load_steps=2 format=3 uid="uid://dkjv5kj8mgy8v"] + +[ext_resource type="Script" path="res://script/config/character_move_cfg.gd" id="1_7itnl"] + +[resource] +script = ExtResource("1_7itnl") +speed = 1.0 +gravity_scale = 1.0 +jump_velocity = 4.0 diff --git a/resource/animation/character/basic_move.aseprite b/resource/animation/character/basic_move.aseprite index bec0e4c..4c2a75c 100644 Binary files a/resource/animation/character/basic_move.aseprite and b/resource/animation/character/basic_move.aseprite differ diff --git a/resource/animation/character/basic_move.png b/resource/animation/character/basic_move.png index 41856b4..1f573bb 100644 Binary files a/resource/animation/character/basic_move.png and b/resource/animation/character/basic_move.png differ diff --git a/resource/animation/character/monster01_move.aseprite b/resource/animation/character/monster01_move.aseprite index b149a6a..ee986de 100644 Binary files a/resource/animation/character/monster01_move.aseprite and b/resource/animation/character/monster01_move.aseprite differ diff --git a/resource/animation/character/monster02_move.aseprite b/resource/animation/character/monster02_move.aseprite index a87f6b5..4a6f5ad 100644 Binary files a/resource/animation/character/monster02_move.aseprite and b/resource/animation/character/monster02_move.aseprite differ diff --git a/resource/animation/character/monster02_move.png b/resource/animation/character/monster02_move.png index 7535235..43d7e5b 100644 Binary files a/resource/animation/character/monster02_move.png and b/resource/animation/character/monster02_move.png differ diff --git a/resource/animation/character/monster03_move.aseprite b/resource/animation/character/monster03_move.aseprite index 24368cc..d5ad94e 100644 Binary files a/resource/animation/character/monster03_move.aseprite and b/resource/animation/character/monster03_move.aseprite differ diff --git a/resource/ui/hud/break_level.png b/resource/ui/hud/break_level.png index c4f6339..e4a9d56 100644 Binary files a/resource/ui/hud/break_level.png and b/resource/ui/hud/break_level.png differ diff --git a/scene/ai/bullet02.tscn b/scene/ai/bullet02.tscn index 1b4fde1..d7f8ec2 100644 --- a/scene/ai/bullet02.tscn +++ b/scene/ai/bullet02.tscn @@ -8,7 +8,7 @@ [node name="BeehaveTree" type="Node" node_paths=PackedStringArray("blackboard")] script = ExtResource("1_go1b5") -blackboard = NodePath("@Node@19487") +blackboard = NodePath("@Node@82296") [node name="SequenceComposite" type="Node" parent="."] script = ExtResource("2_k8nph") diff --git a/scene/ai/monster01.tscn b/scene/ai/monster01.tscn index e98c12f..945a457 100644 --- a/scene/ai/monster01.tscn +++ b/scene/ai/monster01.tscn @@ -1,13 +1,17 @@ -[gd_scene load_steps=5 format=3 uid="uid://1bjfixh8yjc1"] +[gd_scene load_steps=9 format=3 uid="uid://r4o07ns0q8rg"] [ext_resource type="Script" path="res://addons/beehave/nodes/beehave_tree.gd" id="1_bbyao"] [ext_resource type="Script" path="res://addons/beehave/nodes/composites/sequence.gd" id="2_04nig"] [ext_resource type="Script" path="res://script/ai/action/action_find_target.gd" id="3_c43ds"] -[ext_resource type="Script" path="res://script/ai/action_with_target/action_move_to_target.gd" id="4_xtt4k"] +[ext_resource type="Script" path="res://addons/beehave/nodes/composites/selector.gd" id="4_hf0vc"] +[ext_resource type="Script" path="res://script/ai/action_role_check/action_role_check_is.gd" id="5_niu75"] +[ext_resource type="Script" path="res://script/ai/action_with_target/action_move_to.gd" id="6_l7hec"] +[ext_resource type="Script" path="res://script/ai/action_with_target/action_cast_skill.gd" id="7_up57t"] +[ext_resource type="Script" path="res://script/ai/action/action_wait.gd" id="8_pkgji"] [node name="BeehaveTree" type="Node" node_paths=PackedStringArray("blackboard")] script = ExtResource("1_bbyao") -blackboard = NodePath("@Node@19488") +blackboard = NodePath("@Node@88159") [node name="SequenceComposite" type="Node" parent="."] script = ExtResource("2_04nig") @@ -15,5 +19,48 @@ script = ExtResource("2_04nig") [node name="ActionFindTarget" type="Node" parent="SequenceComposite"] script = ExtResource("3_c43ds") -[node name="ActionMoveToTarget" type="Node" parent="SequenceComposite"] -script = ExtResource("4_xtt4k") +[node name="SelectorComposite" type="Node" parent="SequenceComposite"] +script = ExtResource("4_hf0vc") + +[node name="SequenceComposite" type="Node" parent="SequenceComposite/SelectorComposite"] +script = ExtResource("2_04nig") + +[node name="ActionRoleCheckIs" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite"] +script = ExtResource("5_niu75") +key = 1 + +[node name="ActionMoveTo" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite"] +script = ExtResource("6_l7hec") +dist_max = 2.0 + +[node name="ActionCastSkill" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite"] +script = ExtResource("7_up57t") + +[node name="SequenceComposite2" type="Node" parent="SequenceComposite/SelectorComposite"] +script = ExtResource("2_04nig") + +[node name="ActionRoleCheckIs" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite2"] +script = ExtResource("5_niu75") +key = 2 + +[node name="ActionMoveTo" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite2"] +script = ExtResource("6_l7hec") +dist_min = 3.0 +dist_max = 4.0 + +[node name="ActionCastSkill" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite2"] +script = ExtResource("7_up57t") + +[node name="SequenceComposite3" type="Node" parent="SequenceComposite/SelectorComposite"] +script = ExtResource("2_04nig") + +[node name="ActionRoleCheckIs" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite3"] +script = ExtResource("5_niu75") + +[node name="ActionMoveTo" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite3"] +script = ExtResource("6_l7hec") +dist_min = 4.0 + +[node name="ActionWait" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite3"] +script = ExtResource("8_pkgji") +wait_time = 2.0 diff --git a/scene/ai/monster02.tscn b/scene/ai/monster02.tscn index c8de471..d9317ac 100644 --- a/scene/ai/monster02.tscn +++ b/scene/ai/monster02.tscn @@ -1,19 +1,66 @@ -[gd_scene load_steps=5 format=3 uid="uid://2e2ws176hev1"] +[gd_scene load_steps=9 format=3 uid="uid://c0velv8p4imxa"] -[ext_resource type="Script" path="res://addons/beehave/nodes/beehave_tree.gd" id="1_y3xa0"] -[ext_resource type="Script" path="res://addons/beehave/nodes/composites/sequence.gd" id="2_ohjmj"] -[ext_resource type="Script" path="res://script/ai/action/action_find_target.gd" id="3_fmht1"] -[ext_resource type="Script" path="res://script/ai/action_with_target/action_move_to_target.gd" id="4_pwax0"] +[ext_resource type="Script" path="res://addons/beehave/nodes/beehave_tree.gd" id="1_c24lj"] +[ext_resource type="Script" path="res://addons/beehave/nodes/composites/sequence.gd" id="2_jjdrd"] +[ext_resource type="Script" path="res://script/ai/action/action_find_target.gd" id="3_82jsi"] +[ext_resource type="Script" path="res://addons/beehave/nodes/composites/selector.gd" id="4_wtlw0"] +[ext_resource type="Script" path="res://script/ai/action_role_check/action_role_check_is.gd" id="5_80c8u"] +[ext_resource type="Script" path="res://script/ai/action_with_target/action_move_to.gd" id="6_u68e8"] +[ext_resource type="Script" path="res://script/ai/action_with_target/action_cast_skill.gd" id="7_w5xrf"] +[ext_resource type="Script" path="res://script/ai/action/action_wait.gd" id="8_kaxnh"] [node name="BeehaveTree" type="Node" node_paths=PackedStringArray("blackboard")] -script = ExtResource("1_y3xa0") -blackboard = NodePath("@Node@79226") +script = ExtResource("1_c24lj") +blackboard = NodePath("@Node@19489") [node name="SequenceComposite" type="Node" parent="."] -script = ExtResource("2_ohjmj") +script = ExtResource("2_jjdrd") [node name="ActionFindTarget" type="Node" parent="SequenceComposite"] -script = ExtResource("3_fmht1") +script = ExtResource("3_82jsi") -[node name="ActionMoveToTarget" type="Node" parent="SequenceComposite"] -script = ExtResource("4_pwax0") +[node name="SelectorComposite" type="Node" parent="SequenceComposite"] +script = ExtResource("4_wtlw0") + +[node name="SequenceComposite" type="Node" parent="SequenceComposite/SelectorComposite"] +script = ExtResource("2_jjdrd") + +[node name="ActionRoleCheckIs" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite"] +script = ExtResource("5_80c8u") +key = 1 + +[node name="ActionMoveTo" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite"] +script = ExtResource("6_u68e8") +dist_max = 2.0 + +[node name="ActionCastSkill" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite"] +script = ExtResource("7_w5xrf") + +[node name="SequenceComposite2" type="Node" parent="SequenceComposite/SelectorComposite"] +script = ExtResource("2_jjdrd") + +[node name="ActionRoleCheckIs" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite2"] +script = ExtResource("5_80c8u") +key = 2 + +[node name="ActionMoveTo" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite2"] +script = ExtResource("6_u68e8") +dist_min = 3.0 +dist_max = 4.0 + +[node name="ActionCastSkill" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite2"] +script = ExtResource("7_w5xrf") + +[node name="SequenceComposite3" type="Node" parent="SequenceComposite/SelectorComposite"] +script = ExtResource("2_jjdrd") + +[node name="ActionRoleCheckIs" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite3"] +script = ExtResource("5_80c8u") + +[node name="ActionMoveTo" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite3"] +script = ExtResource("6_u68e8") +dist_min = 4.0 + +[node name="ActionWait" type="Node" parent="SequenceComposite/SelectorComposite/SequenceComposite3"] +script = ExtResource("8_kaxnh") +wait_time = 2.0 diff --git a/scene/ui/item/headbar.tscn b/scene/ui/item/headbar.tscn index 164aed1..6ad4d16 100644 --- a/scene/ui/item/headbar.tscn +++ b/scene/ui/item/headbar.tscn @@ -29,10 +29,9 @@ offset_bottom = 2.0 grow_horizontal = 2 grow_vertical = 2 value = 60.0 -stretch_margin_left = 10 -stretch_margin_top = 10 -stretch_margin_right = 10 -stretch_margin_bottom = 10 +nine_patch_stretch = true +stretch_margin_left = 1 +stretch_margin_right = 1 texture_under = ExtResource("2_g5t31") texture_progress = ExtResource("3_vh1p5") tint_progress = Color(1, 0, 0, 1) @@ -52,9 +51,12 @@ offset_bottom = 2.0 grow_horizontal = 2 grow_vertical = 2 value = 50.0 +nine_patch_stretch = true +stretch_margin_left = 1 +stretch_margin_right = 1 texture_under = ExtResource("2_g5t31") texture_progress = ExtResource("3_vh1p5") -tint_progress = Color(0, 1, 1, 1) +tint_progress = Color(0.996078, 0.752941, 0.278431, 1) [node name="BreakLevel" type="Sprite2D" parent="."] unique_name_in_owner = true diff --git a/script/ai/action_with_target/action_cast_skill.gd b/script/ai/action_with_target/action_cast_skill.gd index bc689ea..046b90f 100644 --- a/script/ai/action_with_target/action_cast_skill.gd +++ b/script/ai/action_with_target/action_cast_skill.gd @@ -5,11 +5,14 @@ func execute(character: Character, target: Character, blackboard: Blackboard) -> var skill: Skill = character.skill var status: Status = character.status var dir: Vector2 = target.pos2D() - character.pos2D() + var dist: float = dir.length() if status.is_skill_running: if int(status.break_level) < Enum.EBreakLevel.Break: - character.move_to(dir) + if dist < 0.5: + character.move_to(-dir) + elif dist > 2: + character.move_to(dir) return RUNNING - var dist: float = dir.length() for skill_cfg: SkillCfg in skill.skill_dict.values(): #检查姿态 var stance_from: int = skill_cfg.stance_from diff --git a/script/ai/action_with_target/action_move_to.gd b/script/ai/action_with_target/action_move_to.gd index 07f27fa..ee65a35 100644 --- a/script/ai/action_with_target/action_move_to.gd +++ b/script/ai/action_with_target/action_move_to.gd @@ -3,6 +3,7 @@ class_name ActionMoveTo @export var dist_min: float = 0 @export var dist_max: float = 5 +@export var offset: float = 0.1 #0为无偏差 1为偏差90度 func execute(character: Character, target: Character, blackboard: Blackboard) -> int: @@ -11,6 +12,9 @@ func execute(character: Character, target: Character, blackboard: Blackboard) -> if (dist > dist_min ) and (dist < dist_max): character.move_stop() return SUCCESS - var is_far: bool = dist >= dist_max + var is_far: bool = dist >= dist_max + var to_dir: Vector2 = dir if is_far else -dir + var offset_deg: float = 90 * randf() * clamp(offset, 0, 1) * (1 if randf() < 0.5 else -1) + to_dir = to_dir.rotated(deg_to_rad(offset_deg)) character.move_to(dir if is_far else -dir) return FAILURE diff --git a/script/ai/action_with_target/action_move_to_target.gd b/script/ai/action_with_target/action_move_to_target.gd deleted file mode 100644 index 22db4a3..0000000 --- a/script/ai/action_with_target/action_move_to_target.gd +++ /dev/null @@ -1,12 +0,0 @@ -extends ActionWithTarget -class_name ActionMoveToTarget - -func execute(character: Character, target: Character, blackboard: Blackboard) -> int: - var dir: Vector2 = target.pos2D() - character.pos2D() - var dist: float = dir.length() - if dist < 1: - character.move_stop() - else: - character.move_to(dir) - return RUNNING - return SUCCESS diff --git a/script/character/battle.gd b/script/character/battle.gd index 33f206c..3072c43 100644 --- a/script/character/battle.gd +++ b/script/character/battle.gd @@ -127,8 +127,10 @@ func add_attack(from: int, to: int, dir: Vector2, attack: AttackCfg) -> HitResul is_break_skill = is_break_skill_real or not character_to.get_status("is_on_floor") if break_level_sub < 0: damage = 0 + pause_time *= 2 elif break_level_sub == 0: damage *= 0.5 + pause_time *= 1.5 is_floating = is_break_skill and is_floating is_hit_down = is_break_skill and is_hit_down diff --git a/script/character/character.gd b/script/character/character.gd index 7efd476..f8e7115 100644 --- a/script/character/character.gd +++ b/script/character/character.gd @@ -42,17 +42,18 @@ func set_body_scale(cfg: CharacterCfg) -> void: cfg = status.cfg if not cfg: return - var half_height: float = Setting.pixel_size * cfg.sprite_harf_height - var height: float = half_height * 2 - var width: float = Setting.pixel_size * cfg.sprite_width - var body_scale: Vector3 = Vector3(width, height, width) + var height: float = Setting.pixel_size * cfg.sprite_height + var width: float = Setting.pixel_size * cfg.sprite_width + var body_scale: Vector3 = Vector3(width, height, width) + var half_height: float = height / 2 + var center_height: float = Setting.pixel_size * 26 collision.position = Vector3(0, half_height, 0) collision.scale = body_scale pushbox.position = Vector3(0, half_height, 0) pushbox.scale = body_scale - status.basic_offset = Vector3(0, half_height, 0) - status.ui_offset = Vector3(0, height*1.1, 0) - status.ui_center_offset = Vector3(0, half_height, 0) + status.basic_offset = Vector3(0, center_height, 0) + status.ui_offset = Vector3(0, height*1.25, 0) + status.ui_center_offset = Vector3(0, center_height, 0) status.radius = width status.height = height effect.set_body_scale(body_scale) diff --git a/script/character/player/player_action.gd b/script/character/player/player_action.gd index 4d900bc..da16797 100644 --- a/script/character/player/player_action.gd +++ b/script/character/player/player_action.gd @@ -52,7 +52,9 @@ func check_action_pressed(key: String) -> bool: "weapon_pre": combo.weapon_index_change(-1) "weapon_next": combo.weapon_index_change(1) "test_1": - Global.character_mgr.create_character(ResourceManager.cfg_character_monster_test, Enum.ETeam.Monster, Vector3(5.5, 0, 2)) + Global.character_mgr.create_character(ResourceManager.cfg_character_monster_test1, Enum.ETeam.Monster, Vector3(5.5, 0, 2)) + Global.character_mgr.create_character(ResourceManager.cfg_character_monster_test2, Enum.ETeam.Monster, Vector3(5.5, 0, 2)) + Global.character_mgr.create_character(ResourceManager.cfg_character_monster_test3, Enum.ETeam.Monster, Vector3(5.5, 0, 2)) _: return false return true diff --git a/script/config/character_cfg.gd b/script/config/character_cfg.gd index ff5107b..4e821aa 100644 --- a/script/config/character_cfg.gd +++ b/script/config/character_cfg.gd @@ -6,7 +6,7 @@ class_name CharacterCfg @export var type: Enum.ECharacterType #动画 @export var sprite_frames: SpriteFrames -@export var sprite_harf_height: int +@export var sprite_height: int @export var sprite_width: int #基本组件 @export var move: CharacterMoveCfg diff --git a/script/manager/ai_manager.gd b/script/manager/ai_manager.gd index 086a7ec..a9c75eb 100644 --- a/script/manager/ai_manager.gd +++ b/script/manager/ai_manager.gd @@ -3,9 +3,6 @@ class_name AIManager var tick_time: float = 1 var tick_time_left: float = 1 -var role_num_1: int = 2 #近战 -var role_num_2: int = 1 #刺客 -var role_num_3: int = 2 #远程 func _ready(): @@ -25,7 +22,11 @@ func _process(delta) -> void: if not enemy_list: return var pos_player: Vector2 = player.pos2D() enemy_list.sort_custom(func(a: Character, b: Character): return a.pos2D().distance_squared_to(pos_player) < b.pos2D().distance_squared_to(pos_player)) - var index: int = 0 + var count: int = enemy_list.size() + var role_num_1: int = max(int(count*0.2), 2) #近战 + var role_num_2: int = max(int(count*0.1), 1) #刺客 + var role_num_3: int = max(int(count*0.2), 2) #远程 + var index: int = 0 for enemy in enemy_list: if enemy.get_status("is_stagger") or enemy.get_status("is_stun"): enemy.set_status("ai_role", Enum.EAIRoleType.None) diff --git a/script/manager/resource_manager.gd b/script/manager/resource_manager.gd index 1409a2d..a0786bf 100644 --- a/script/manager/resource_manager.gd +++ b/script/manager/resource_manager.gd @@ -17,7 +17,9 @@ var particle_debug_cylinder: PackedScene = load("res://scene/effect/particl #==config== #character var cfg_character_player: CharacterCfg = load("res://config/character/hero01.tres") as CharacterCfg -var cfg_character_monster_test: CharacterCfg = load("res://config/character/monster03.tres") as CharacterCfg +var cfg_character_monster_test1: CharacterCfg = load("res://config/character/monster01.tres") as CharacterCfg +var cfg_character_monster_test2: CharacterCfg = load("res://config/character/monster02.tres") as CharacterCfg +var cfg_character_monster_test3: CharacterCfg = load("res://config/character/monster03.tres") as CharacterCfg #attack var cfg_attack_normal: AttackCfg = load("res://config/attack/sharp_normal_hit.tres") as AttackCfg var cfg_attack_box_normal: AttackCfg = load("res://config/attack_box/circle_normal.tres") as AttackCfg diff --git a/script/ui/hud/headbar.gd b/script/ui/hud/headbar.gd index 4bb67dd..5fdcdba 100644 --- a/script/ui/hud/headbar.gd +++ b/script/ui/hud/headbar.gd @@ -17,13 +17,29 @@ func set_debug_info_show(is_show: bool) -> void: var debug_info: Control = (%DebugInfo as Control) debug_info.visible = is_show + +func set_length(hp: float) -> void: + if hp > 100: + return + var length_px: int = max(32 * hp / 100, 10) + if (length_px % 2) == 1: + length_px += 1 + hp_bar.size.x = length_px + hp_bar.position.x = -length_px / 2 + shield_bar.size.x = length_px + shield_bar.position.x = -length_px / 2 + break_level.position.x = -length_px / 2 - 5 + + var hit_text_damage_cache: HitText func on_hp_changed(value): hp_bar.value = value -func on_hp_max_changed(value): hp_bar.max_value = value +func on_hp_max_changed(value): + hp_bar.max_value = value + set_length(value) func on_shield_changed(value):