forked from moyin/whale-town-front
feat: 增加player从广场到房间互相跳转的动作逻辑
This commit is contained in:
@@ -13,9 +13,17 @@ const MOVE_SPEED = 200.0
|
||||
var last_direction := "down"
|
||||
|
||||
func _ready() -> void:
|
||||
# 检查是否有初始位置设置
|
||||
call_deferred("_check_spawn_position")
|
||||
|
||||
# 播放初始动画
|
||||
if animation_player.has_animation("idle"):
|
||||
animation_player.play("idle")
|
||||
|
||||
func _check_spawn_position() -> void:
|
||||
var spawn_pos = SceneManager.get_next_scene_position()
|
||||
if spawn_pos != null:
|
||||
global_position = spawn_pos
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
_handle_movement(delta)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://b2f8e24plwqgj"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://btka26hrcvgen" path="res://Scenes/characters/player.gd" id="1_script"]
|
||||
[ext_resource type="Texture2D" uid="uid://dpym0k5vurobw" path="res://assets/characters/player_spritesheet.png" id="2_texture"]
|
||||
[ext_resource type="Texture2D" uid="uid://cghab1hkx5lg5" path="res://assets/characters/player_spritesheet.png" id="2_texture"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_1"]
|
||||
radius = 16.0
|
||||
radius = 21.0
|
||||
height = 48.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_idle_down"]
|
||||
@@ -145,14 +145,14 @@ tracks/0/keys = {
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1"]
|
||||
_data = {
|
||||
"idle_down": SubResource("Animation_idle_down"),
|
||||
"idle_left": SubResource("Animation_idle_left"),
|
||||
"idle_right": SubResource("Animation_idle_right"),
|
||||
"idle_up": SubResource("Animation_idle_up"),
|
||||
"walk_down": SubResource("Animation_walk_down"),
|
||||
"walk_left": SubResource("Animation_walk_left"),
|
||||
"walk_right": SubResource("Animation_walk_right"),
|
||||
"walk_up": SubResource("Animation_walk_up")
|
||||
&"idle_down": SubResource("Animation_idle_down"),
|
||||
&"idle_left": SubResource("Animation_idle_left"),
|
||||
&"idle_right": SubResource("Animation_idle_right"),
|
||||
&"idle_up": SubResource("Animation_idle_up"),
|
||||
&"walk_down": SubResource("Animation_walk_down"),
|
||||
&"walk_left": SubResource("Animation_walk_left"),
|
||||
&"walk_right": SubResource("Animation_walk_right"),
|
||||
&"walk_up": SubResource("Animation_walk_up")
|
||||
}
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
@@ -160,18 +160,17 @@ script = ExtResource("1_script")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(1.5000005, -24.5)
|
||||
scale = Vector2(1, 1)
|
||||
texture = ExtResource("2_texture")
|
||||
hframes = 4
|
||||
vframes = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -24)
|
||||
position = Vector2(2, -24)
|
||||
shape = SubResource("CapsuleShape2D_1")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_1")
|
||||
&"": SubResource("AnimationLibrary_1")
|
||||
}
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
|
||||
Reference in New Issue
Block a user