1
0
mirror of https://gitee.com/freeyz/godot-mota.git synced 2024-12-22 18:49:21 +08:00

修复剧情动画bug

This commit is contained in:
freewu32 2020-08-21 10:51:23 +08:00
parent a31d0548ed
commit 19b9823ecb
7 changed files with 81 additions and 31 deletions

View File

@ -16,3 +16,4 @@ func showDialog(message:String) -> PopupDialog:
func on_message_dialog_input(event: InputEvent):
if event is InputEventMouseButton and event.pressed:
message_dlalog.visible = false
message_dlalog.accept_event()

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://src/player/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/level/LevelInstance.gd" type="Script" id=2]
[ext_resource path="res://src/stairs/StairsUp.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/navigation/NavigationTileMap.gd" type="Script" id=4]
[ext_resource path="res://src/navigation/NavigationTileset.tres" type="TileSet" id=5]
@ -17,11 +18,16 @@ occluder_light_mask = 0
format = 1
tile_data = PoolIntArray( 196608, 1, 0, 196609, 1, 0, 196610, 1, 0, 196611, 1, 0, 196612, 1, 0, 196613, 1, 0, 196614, 1, 0, 196615, 1, 0, 196616, 1, 0, 196617, 1, 0, 196618, 1, 0, 196619, 1, 0, 196620, 1, 0, 262144, 1, 0, 262145, 2, 0, 262146, 2, 0, 262147, 2, 0, 262148, 2, 0, 262149, 2, 0, 262150, 2, 0, 262151, 2, 0, 262152, 2, 0, 262153, 2, 0, 262154, 2, 0, 262155, 2, 0, 262156, 1, 0, 327680, 1, 0, 327681, 1, 0, 327682, 1, 0, 327683, 1, 0, 327684, 1, 0, 327685, 1, 0, 327686, 1, 0, 327687, 1, 0, 327688, 1, 0, 327689, 1, 0, 327690, 1, 0, 327691, 2, 0, 327692, 1, 0, 393216, 1, 0, 393217, 2, 0, 393218, 2, 0, 393219, 2, 0, 393220, 2, 0, 393221, 2, 0, 393222, 1, 0, 393223, 2, 0, 393224, 2, 0, 393225, 2, 0, 393226, 1, 0, 393227, 2, 0, 393228, 1, 0, 458752, 1, 0, 458753, 2, 0, 458754, 2, 0, 458755, 2, 0, 458756, 1, 0, 458757, 2, 0, 458758, 1, 0, 458759, 2, 0, 458760, 2, 0, 458761, 2, 0, 458762, 1, 0, 458763, 2, 0, 458764, 1, 0, 524288, 1, 0, 524289, 1, 0, 524290, 2, 0, 524291, 1, 0, 524292, 1, 0, 524293, 2, 0, 524294, 1, 0, 524295, 1, 0, 524296, 1, 0, 524297, 2, 0, 524298, 1, 0, 524299, 2, 0, 524300, 1, 0, 589824, 1, 0, 589825, 2, 0, 589826, 2, 0, 589827, 2, 0, 589828, 1, 0, 589829, 2, 0, 589830, 2, 0, 589831, 2, 0, 589832, 2, 0, 589833, 2, 0, 589834, 1, 0, 589835, 2, 0, 589836, 1, 0, 655360, 1, 0, 655361, 2, 0, 655362, 2, 0, 655363, 2, 0, 655364, 1, 0, 655365, 2, 0, 655366, 1, 0, 655367, 1, 0, 655368, 1, 0, 655369, 1, 0, 655370, 1, 0, 655371, 2, 0, 655372, 1, 0, 720896, 1, 0, 720897, 1, 0, 720898, 2, 0, 720899, 1, 0, 720900, 1, 0, 720901, 2, 0, 720902, 2, 0, 720903, 2, 0, 720904, 2, 0, 720905, 2, 0, 720906, 2, 0, 720907, 2, 0, 720908, 1, 0, 786432, 1, 0, 786433, 2, 0, 786434, 2, 0, 786435, 2, 0, 786436, 1, 0, 786437, 1, 0, 786438, 2, 0, 786439, 1, 0, 786440, 1, 0, 786441, 1, 0, 786442, 2, 0, 786443, 1, 0, 786444, 1, 0, 851968, 1, 0, 851969, 2, 0, 851970, 2, 0, 851971, 2, 0, 851972, 1, 0, 851973, 2, 0, 851974, 2, 0, 851975, 2, 0, 851976, 1, 0, 851977, 2, 0, 851978, 2, 0, 851979, 2, 0, 851980, 1, 0, 917504, 1, 0, 917505, 2, 0, 917506, 2, 0, 917507, 2, 0, 917508, 1, 0, 917509, 2, 0, 917510, 2, 0, 917511, 2, 0, 917512, 1, 0, 917513, 2, 0, 917514, 2, 0, 917515, 2, 0, 917516, 1, 0, 983040, 1, 0, 983041, 1, 0, 983042, 1, 0, 983043, 1, 0, 983044, 1, 0, 983045, 1, 0, 983046, 1, 0, 983047, 1, 0, 983048, 1, 0, 983049, 1, 0, 983050, 1, 0, 983051, 1, 0, 983052, 1, 0 )
script = ExtResource( 4 )
navigation_cell_index = 2
wall_cell_index = 1
changed_cells = {
}
[node name="Items" type="Node2D" parent="."]
[node name="Stairs" parent="Items" instance=ExtResource( 3 )]
position = Vector2( 48, 144 )
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 207, 464 )

View File

@ -14,28 +14,28 @@
[ext_resource path="res://assets/images/npcs.png" type="Texture" id=12]
[ext_resource path="res://src/npc/HelpEscape.gd" type="Script" id=13]
[sub_resource type="RectangleShape2D" id=4]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 16 )
[sub_resource type="AtlasTexture" id=1]
flags = 4
atlas = ExtResource( 12 )
region = Rect2( 0, 64, 32, 32 )
[sub_resource type="AtlasTexture" id=2]
flags = 4
atlas = ExtResource( 12 )
region = Rect2( 0, 64, 32, 32 )
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 12 )
region = Rect2( 32, 64, 32, 32 )
[sub_resource type="SpriteFrames" id=3]
[sub_resource type="SpriteFrames" id=4]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ) ],
"frames": [ SubResource( 2 ), SubResource( 3 ) ],
"loop": true,
"name": "thief",
"speed": 5.0
} ]
[sub_resource type="Animation" id=6]
[sub_resource type="Animation" id=5]
resource_name = "leave"
tracks/0/type = "value"
tracks/0/path = NodePath(".:position")
@ -61,9 +61,23 @@ tracks/1/keys = {
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
tracks/2/type = "method"
tracks/2/path = NodePath("../Player")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 1 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "resume"
} ]
}
[sub_resource type="Animation" id=5]
resource_name = "open_door"
[sub_resource type="Animation" id=6]
length = 1.5
tracks/0/type = "value"
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
@ -71,11 +85,39 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.5, 1 ),
"times": PoolRealArray( 0.5, 1, 1.5 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 112, 336 ), Vector2( 48, 336 ), Vector2( 48, 400 ) ]
}
tracks/1/type = "method"
tracks/1/path = NodePath("../Items/HiddenDoor")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "open"
} ]
}
tracks/2/type = "method"
tracks/2/path = NodePath("../Player")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 1.5 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "resume"
} ]
}
[node name="Level2" type="Node2D"]
script = ExtResource( 2 )
@ -87,6 +129,8 @@ cell_quadrant_size = 1
format = 1
tile_data = PoolIntArray( 196608, 1, 0, 196609, 1, 0, 196610, 1, 0, 196611, 1, 0, 196612, 1, 0, 196613, 1, 0, 196614, 1, 0, 196615, 1, 0, 196616, 1, 0, 196617, 1, 0, 196618, 1, 0, 196619, 1, 0, 196620, 1, 0, 262144, 1, 0, 262145, 2, 0, 262146, 2, 0, 262147, 2, 0, 262148, 2, 0, 262149, 2, 0, 262150, 2, 0, 262151, 2, 0, 262152, 2, 0, 262153, 2, 0, 262154, 2, 0, 262155, 2, 0, 262156, 1, 0, 327680, 1, 0, 327681, 2, 0, 327682, 2, 0, 327683, 1, 0, 327684, 1, 0, 327685, 2, 0, 327686, 2, 0, 327687, 2, 0, 327688, 2, 0, 327689, 2, 0, 327690, 1, 0, 327691, 1, 0, 327692, 1, 0, 393216, 1, 0, 393217, 2, 0, 393218, 1, 0, 393219, 1, 0, 393220, 1, 0, 393221, 1, 0, 393222, 1, 0, 393223, 2, 0, 393224, 1, 0, 393225, 1, 0, 393226, 1, 0, 393227, 1, 0, 393228, 1, 0, 458752, 1, 0, 458753, 2, 0, 458754, 1, 0, 458755, 2, 0, 458756, 2, 0, 458757, 1, 0, 458758, 2, 0, 458759, 2, 0, 458760, 2, 0, 458761, 1, 0, 458762, 2, 0, 458763, 2, 0, 458764, 1, 0, 524288, 1, 0, 524289, 2, 0, 524290, 1, 0, 524291, 2, 0, 524292, 2, 0, 524293, 2, 0, 524294, 2, 0, 524295, 2, 0, 524296, 2, 0, 524297, 2, 0, 524298, 2, 0, 524299, 2, 0, 524300, 1, 0, 589824, 1, 0, 589825, 2, 0, 589826, 1, 0, 589827, 1, 0, 589828, 1, 0, 589829, 1, 0, 589830, 2, 0, 589831, 2, 0, 589832, 2, 0, 589833, 1, 0, 589834, 1, 0, 589835, 1, 0, 589836, 1, 0, 655360, 1, 0, 655361, 2, 0, 655363, 2, 0, 655364, 2, 0, 655365, 1, 0, 655366, 2, 0, 655367, 2, 0, 655368, 2, 0, 655369, 1, 0, 655370, 2, 0, 655371, 2, 0, 655372, 1, 0, 720896, 1, 0, 720897, 2, 0, 720898, 1, 0, 720899, 2, 0, 720900, 2, 0, 720901, 2, 0, 720902, 2, 0, 720903, 2, 0, 720904, 2, 0, 720905, 2, 0, 720906, 2, 0, 720907, 2, 0, 720908, 1, 0, 786432, 1, 0, 786433, 2, 0, 786434, 1, 0, 786435, 1, 0, 786436, 1, 0, 786437, 1, 0, 786438, 2, 0, 786439, 2, 0, 786440, 2, 0, 786441, 1, 0, 786442, 1, 0, 786443, 1, 0, 786444, 1, 0, 851968, 1, 0, 851969, 2, 0, 851970, 1, 0, 851971, 2, 0, 851972, 2, 0, 851973, 1, 0, 851974, 2, 0, 851975, 2, 0, 851976, 2, 0, 851977, 1, 0, 851978, 2, 0, 851979, 2, 0, 851980, 1, 0, 917504, 1, 0, 917505, 2, 0, 917506, 1, 0, 917507, 2, 0, 917508, 2, 0, 917509, 2, 0, 917510, 2, 0, 917511, 2, 0, 917512, 2, 0, 917513, 2, 0, 917514, 2, 0, 917515, 2, 0, 917516, 1, 0, 983040, 1, 0, 983041, 1, 0, 983042, 1, 0, 983043, 1, 0, 983044, 1, 0, 983045, 1, 0, 983046, 1, 0, 983047, 1, 0, 983048, 1, 0, 983049, 1, 0, 983050, 1, 0, 983051, 1, 0, 983052, 1, 0 )
script = ExtResource( 4 )
navigation_cell_index = 2
wall_cell_index = 1
changed_cells = {
}
@ -98,27 +142,21 @@ position = Vector2( 112, 144 )
[node name="IronDoor" parent="Items" instance=ExtResource( 7 )]
position = Vector2( 176, 272 )
enabled = true
[node name="IronDoor2" parent="Items" instance=ExtResource( 7 )]
position = Vector2( 176, 368 )
enabled = true
[node name="IronDoor3" parent="Items" instance=ExtResource( 7 )]
position = Vector2( 176, 464 )
enabled = true
[node name="IronDoor4" parent="Items" instance=ExtResource( 7 )]
position = Vector2( 304, 464 )
enabled = true
[node name="IronDoor5" parent="Items" instance=ExtResource( 7 )]
position = Vector2( 304, 368 )
enabled = true
[node name="IronDoor6" parent="Items" instance=ExtResource( 7 )]
position = Vector2( 304, 272 )
enabled = true
[node name="HiddenDoor" parent="Items" instance=ExtResource( 8 )]
position = Vector2( 80, 336 )
@ -148,25 +186,26 @@ position = Vector2( 144, 432 )
[node name="Stairs2" parent="Items" instance=ExtResource( 10 )]
position = Vector2( 48, 464 )
[node name="StaticBody2D" type="StaticBody2D" parent="."]
[node name="Thief" type="StaticBody2D" parent="."]
position = Vector2( 112, 336 )
script = ExtResource( 13 )
__meta__ = {
"_edit_group_": true
}
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
shape = SubResource( 4 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Thief"]
shape = SubResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="StaticBody2D"]
frames = SubResource( 3 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="Thief"]
frames = SubResource( 4 )
animation = "thief"
frame = 1
playing = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="StaticBody2D"]
anims/leave = SubResource( 6 )
anims/open_door = SubResource( 5 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="Thief"]
anims/leave = SubResource( 5 )
anims/open_door = SubResource( 6 )
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 112, 368 )
position = Vector2( 48, 176 )
navigation_tile_map_path = NodePath("../../Level2/NavigationTileMap")

View File

@ -21,6 +21,8 @@ cell_quadrant_size = 1
format = 1
tile_data = PoolIntArray( 196608, 1, 0, 196609, 1, 0, 196610, 1, 0, 196611, 1, 0, 196612, 1, 0, 196613, 1, 0, 196614, 1, 0, 196615, 1, 0, 196616, 1, 0, 196617, 1, 0, 196618, 1, 0, 196619, 1, 0, 196620, 1, 0, 262144, 1, 0, 262145, 2, 0, 262146, 2, 0, 262147, 1, 0, 262148, 2, 0, 262149, 2, 0, 262150, 2, 0, 262151, 1, 0, 262152, 2, 0, 262153, 1, 0, 262154, 2, 0, 262155, 2, 0, 262156, 1, 0, 327680, 1, 0, 327681, 2, 0, 327682, 2, 0, 327683, 1, 0, 327684, 2, 0, 327685, 2, 0, 327686, 2, 0, 327687, 1, 0, 327688, 2, 0, 327689, 2, 0, 327690, 2, 0, 327691, 2, 0, 327692, 1, 0, 393216, 1, 0, 393217, 2, 0, 393218, 2, 0, 393219, 1, 0, 393220, 2, 0, 393221, 2, 0, 393222, 2, 0, 393223, 1, 0, 393224, 2, 0, 393225, 1, 0, 393226, 1, 0, 393227, 1, 0, 393228, 1, 0, 458752, 1, 0, 458753, 2, 0, 458754, 1, 0, 458755, 1, 0, 458756, 1, 0, 458757, 2, 0, 458758, 1, 0, 458759, 1, 0, 458760, 2, 0, 458761, 1, 0, 458762, 2, 0, 458763, 2, 0, 458764, 1, 0, 524288, 1, 0, 524289, 2, 0, 524290, 2, 0, 524291, 2, 0, 524292, 2, 0, 524293, 2, 0, 524294, 2, 0, 524295, 2, 0, 524296, 2, 0, 524297, 2, 0, 524298, 2, 0, 524299, 2, 0, 524300, 1, 0, 589824, 1, 0, 589825, 2, 0, 589826, 1, 0, 589827, 1, 0, 589828, 2, 0, 589829, 2, 0, 589830, 2, 0, 589831, 1, 0, 589832, 2, 0, 589833, 1, 0, 589834, 1, 0, 589835, 1, 0, 589836, 1, 0, 655360, 1, 0, 655361, 2, 0, 655362, 2, 0, 655363, 1, 0, 655364, 1, 0, 655365, 2, 0, 655366, 1, 0, 655367, 1, 0, 655368, 2, 0, 655369, 1, 0, 655370, 2, 0, 655371, 2, 0, 655372, 1, 0, 720896, 1, 0, 720897, 2, 0, 720898, 2, 0, 720899, 1, 0, 720900, 2, 0, 720901, 2, 0, 720902, 2, 0, 720903, 1, 0, 720904, 2, 0, 720905, 2, 0, 720906, 2, 0, 720907, 2, 0, 720908, 1, 0, 786432, 1, 0, 786433, 2, 0, 786434, 2, 0, 786435, 1, 0, 786436, 2, 0, 786437, 2, 0, 786438, 2, 0, 786439, 1, 0, 786440, 2, 0, 786441, 1, 0, 786442, 1, 0, 786443, 1, 0, 786444, 1, 0, 851968, 1, 0, 851969, 1, 0, 851970, 1, 0, 851971, 1, 0, 851972, 1, 0, 851973, 2, 0, 851974, 1, 0, 851975, 1, 0, 851976, 2, 0, 851977, 1, 0, 851978, 2, 0, 851979, 2, 0, 851980, 1, 0, 917504, 1, 0, 917505, 2, 0, 917506, 2, 0, 917507, 2, 0, 917508, 2, 0, 917509, 2, 0, 917510, 2, 0, 917511, 1, 0, 917512, 2, 0, 917513, 2, 0, 917514, 2, 0, 917515, 2, 0, 917516, 1, 0, 983040, 1, 0, 983041, 1, 0, 983042, 1, 0, 983043, 1, 0, 983044, 1, 0, 983045, 1, 0, 983046, 1, 0, 983047, 1, 0, 983048, 1, 0, 983049, 1, 0, 983050, 1, 0, 983051, 1, 0, 983052, 1, 0 )
script = ExtResource( 2 )
navigation_cell_index = 2
wall_cell_index = 1
changed_cells = {
}

View File

@ -10,18 +10,18 @@ func _ready():
queue_free()
func on_player_touched(player):
print("touched")
var anim_player = $AnimationPlayer as AnimationPlayer
if not once_talked:
player.stop()
yield(Messages.showDialog("你清醒了吗 你到监狱时还处在昏迷中 魔法警卫把你扔到我这个房间 但你很幸运 我刚完成逃跑的暗道你就醒了 我们一起越狱吧"),"popup_hide")
var hidden_door = $"../Items/HiddenDoor" as Door
var navigation_tile_map = $"../NavigationTileMap" as NavigationTileMap
navigation_tile_map.add_navigation_cell(hidden_door.position)
hidden_door.open()
anim_player.play("open_door")
once_talked = true
return
if not second_talked:
player.stop()
yield(Messages.showDialog("我们终于逃出来了 你的剑盾被警卫拿走了 你必须先找到武器 我知道铁建在5楼 铁盾在9楼 你最好先取得它们 我现在还有事没发帮你 再见"),"popup_hide")
anim_player.play("leave")
yield(anim_player,"animation_finished")

View File

@ -73,7 +73,6 @@ func stop():
# 恢复角色运动
func resume():
set_process_unhandled_input(true)
animation_tree.active = true
# 调用被碰撞对象的方法
func call_collider(collision:KinematicCollision2D):

View File

@ -17,6 +17,9 @@ func _on_HitPlot_body_entered(body):
yield(Messages.showDialog("欢迎来到魔塔 你是第100位挑战者 你若能打败我所有的手下 我就与你一对一的对决斗 现在你必须接受我的安排"),"popup_hide")
$Devil/Devils.visible = true
yield(Messages.showDialog("什么"),"popup_hide")
# 初始化勇者位置
var player : Player = body as Player
player.position = Vector2(80,464)
to_second_level()
# 移动角色到二楼监狱