mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-23 12:02:30 +08:00
feat(相机管理): 添加CameraManager类并实现玩家跟随
refactor(物品展示): 修改ItemShow状态机自动隐藏逻辑 feat(游戏逻辑): 添加玩家死亡时的游戏结束界面 style(场景配置): 调整World场景中相机节点位置和偏移 feat(UI): 为ItemShow添加显示动画并更新动画库
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://beo6s1kudbbve"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d3qojeqa3difn" path="res://components/Abstracts/FullscreenPanelBase.tscn" id="1_u2ynr"]
|
||||
[ext_resource type="FontFile" uid="uid://db2jl4bq8idec" path="res://resources/fonts/swyc.ttf" id="3_oynlg"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7gbuu"]
|
||||
bg_color = Color(1, 0, 0, 0.3)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_17i5j"]
|
||||
font = ExtResource("3_oynlg")
|
||||
font_size = 50
|
||||
|
||||
[node name="GameOver" instance=ExtResource("1_u2ynr")]
|
||||
|
||||
[node name="wrapper" parent="content" index="0"]
|
||||
theme_override_constants/separation = 50
|
||||
|
||||
[node name="container" type="PanelContainer" parent="content/wrapper" index="0"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_7gbuu")
|
||||
|
||||
[node name="text" type="Label" parent="content/wrapper/container" index="0"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "败北"
|
||||
label_settings = SubResource("LabelSettings_17i5j")
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://dfwg750a47ggx"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://dfwg750a47ggx"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ofpg5s3j7esv" path="res://components/UI/BossBar.tscn" id="1_2pe58"]
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/UIState.gd" id="1_f00a6"]
|
||||
@@ -7,6 +7,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://1n28ji5sl6bx" path="res://components/Scenes/FullscreenPanels/MakeFeed.tscn" id="4_kkki3"]
|
||||
[ext_resource type="Theme" uid="uid://b6nox1qqh50ub" path="res://themes/smallText.tres" id="5_widd7"]
|
||||
[ext_resource type="StyleBox" uid="uid://bsv1daadkv4eq" path="res://styleboxes/topLeftPanel.tres" id="6_8m0pt"]
|
||||
[ext_resource type="PackedScene" uid="uid://beo6s1kudbbve" path="res://components/Scenes/FullscreenPanels/GameOver.tscn" id="6_10ay6"]
|
||||
[ext_resource type="Texture2D" uid="uid://k13cte17httt" path="res://resources/items/energy.svg" id="7_2om12"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1ulrvupa76ap" path="res://components/UI/ColorBar.tscn" id="9_44nw8"]
|
||||
|
||||
@@ -73,6 +74,10 @@ metadata/_edit_lock_ = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="GameOver" parent="root/panels" instance=ExtResource("6_10ay6")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="energy" type="PanelContainer" parent="root"]
|
||||
custom_minimum_size = Vector2(300, 0)
|
||||
layout_mode = 1
|
||||
|
||||
@@ -18,11 +18,10 @@ position = Vector2(468, 320)
|
||||
texture = ExtResource("6_p0nkj")
|
||||
|
||||
[node name="rooster" parent="." groups=["players"] instance=ExtResource("3_5ui6q")]
|
||||
position = Vector2(394, 274)
|
||||
|
||||
[node name="camera" type="Camera2D" parent="rooster"]
|
||||
[node name="camera" type="Camera2D" parent="."]
|
||||
process_mode = 3
|
||||
position = Vector2(0, -100)
|
||||
offset = Vector2(0, -80)
|
||||
process_callback = 0
|
||||
position_smoothing_enabled = true
|
||||
script = ExtResource("5_mk7bv")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bbm8l3hr4ihar"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bbm8l3hr4ihar"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/ItemShow.gd" id="1_2dhsb"]
|
||||
[ext_resource type="Texture2D" uid="uid://bks8jmctleina" path="res://resources/items/baseball.svg" id="1_hyowb"]
|
||||
@@ -54,10 +54,38 @@ tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_pv00d"]
|
||||
resource_name = "hide"
|
||||
length = 0.5
|
||||
step = 0.1
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale:x")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:modulate:a")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_xbbtb"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_6sxrr"),
|
||||
"hide": SubResource("Animation_ltvf2")
|
||||
"hide": SubResource("Animation_ltvf2"),
|
||||
"show": SubResource("Animation_pv00d")
|
||||
}
|
||||
|
||||
[node name="ItemShow" type="HBoxContainer"]
|
||||
|
||||
@@ -188,7 +188,9 @@ func tryDie(by: BulletBase):
|
||||
if MathTool.rate(GameRule.appleDropRate + by.launcher.fields.get(FieldStore.Entity.DROP_APPLE_RATE)) or isBoss:
|
||||
for i in randi_range(appleCount.x, appleCount.y):
|
||||
ItemDropped.generate(ItemStore.ItemType.APPLE, 1, position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset))
|
||||
die()
|
||||
await die()
|
||||
if isPlayer() and UIState.player == self:
|
||||
UIState.setPanel("GameOver")
|
||||
func tryHeal(count: float):
|
||||
if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
||||
inventory[ItemStore.ItemType.APPLE] -= 1
|
||||
|
||||
@@ -12,6 +12,8 @@ class_name ItemShow
|
||||
|
||||
func _ready():
|
||||
if autoFree:
|
||||
animator.play("show")
|
||||
await animator.animation_finished
|
||||
await TickTool.millseconds(GameRule.itemShowStayTime) # 等待几秒后自动隐藏
|
||||
animator.play("hide")
|
||||
await animator.animation_finished
|
||||
|
||||
@@ -1 +1,11 @@
|
||||
@tool
|
||||
extends Camera2D
|
||||
class_name CameraManager
|
||||
|
||||
static var camera: Camera2D = null
|
||||
|
||||
func _ready():
|
||||
camera = self
|
||||
func _physics_process(_delta):
|
||||
if is_instance_valid(UIState.player):
|
||||
position = UIState.player.position
|
||||
|
||||
Reference in New Issue
Block a user