mirror of
https://gitee.com/freeyz/godot-mota.git
synced 2024-12-22 14:49:21 +08:00
增加图鉴npc
This commit is contained in:
parent
8b83032c44
commit
4599dadf6e
6
Main.gd
6
Main.gd
@ -17,6 +17,7 @@ func connect_player_properties_update():
|
||||
player.connect("yellow_key_changed",self,"on_yellow_key_changed")
|
||||
player.connect("blue_key_changed",self,"on_blue_key_changed")
|
||||
player.connect("red_key_changed",self,"on_red_key_changed")
|
||||
player.connect("prop_added",self,"on_prop_added")
|
||||
|
||||
func connect_button():
|
||||
$"/root/Main/HUD/BottomBackground/VBoxContainer/SaveButton".connect("pressed",self,"on_save_button_clicked")
|
||||
@ -56,6 +57,11 @@ func on_level_changed(level):
|
||||
connect_player_properties_update()
|
||||
get_hud().get_level_view().text = "%s层" % level
|
||||
|
||||
func on_prop_added(name):
|
||||
match name:
|
||||
"book":
|
||||
get_hud().get_book_button_view().visible = true
|
||||
|
||||
func on_save_button_clicked():
|
||||
get_level_manager().save_persistent(0)
|
||||
|
||||
|
@ -302,6 +302,7 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="BookButton" type="TextureButton" parent="HUD/BottomBackground/VBoxContainer"]
|
||||
visible = false
|
||||
margin_right = 36.0
|
||||
margin_bottom = 32.0
|
||||
size_flags_horizontal = 3
|
||||
@ -336,15 +337,14 @@ size_flags_horizontal = 3
|
||||
texture_normal = SubResource( 11 )
|
||||
|
||||
[node name="SaveButton" type="TextureButton" parent="HUD/BottomBackground/VBoxContainer"]
|
||||
margin_left = 44.0
|
||||
margin_right = 80.0
|
||||
margin_right = 36.0
|
||||
margin_bottom = 32.0
|
||||
size_flags_horizontal = 3
|
||||
texture_normal = SubResource( 12 )
|
||||
|
||||
[node name="LoadButton" type="TextureButton" parent="HUD/BottomBackground/VBoxContainer"]
|
||||
margin_left = 88.0
|
||||
margin_right = 124.0
|
||||
margin_left = 44.0
|
||||
margin_right = 80.0
|
||||
margin_bottom = 32.0
|
||||
size_flags_horizontal = 3
|
||||
texture_normal = SubResource( 13 )
|
||||
|
@ -32,6 +32,9 @@ func get_save_button_view() -> TextureButton:
|
||||
func get_load_button_view() -> TextureButton:
|
||||
return $"BottomBackground/VBoxContainer/Loadutton" as TextureButton
|
||||
|
||||
func get_book_button_view() -> TextureButton:
|
||||
return $"BottomBackground/VBoxContainer/BookButton" as TextureButton
|
||||
|
||||
func get_book_dialog_view() -> PopupDialog:
|
||||
return $"BookDialog" as PopupDialog
|
||||
|
||||
|
@ -40,7 +40,6 @@ func load_data(next_level:int):
|
||||
load_data_from_local(next_level)
|
||||
#设置数据
|
||||
level = next_level
|
||||
#emit_signal("level_changed",next_level)
|
||||
|
||||
# 设置楼层和位置
|
||||
func set_level_and_position(next_level:int,position:Vector2):
|
||||
|
@ -87,54 +87,43 @@ position = Vector2( 114.1, 432 )
|
||||
|
||||
[node name="Monster" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 112, 144 )
|
||||
frame = 1
|
||||
|
||||
[node name="Monster2" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 144, 144 )
|
||||
animation = "redSlime"
|
||||
frame = 1
|
||||
|
||||
[node name="Monster4" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 336, 432 )
|
||||
animation = "bat"
|
||||
frame = 1
|
||||
|
||||
[node name="Monster9" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 240, 304 )
|
||||
animation = "bat"
|
||||
frame = 1
|
||||
|
||||
[node name="Monster10" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 272, 304 )
|
||||
animation = "bluePriest"
|
||||
frame = 1
|
||||
|
||||
[node name="Monster11" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 304, 304 )
|
||||
animation = "bat"
|
||||
frame = 1
|
||||
|
||||
[node name="Monster7" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 80, 240 )
|
||||
animation = "skeleton"
|
||||
frame = 1
|
||||
|
||||
[node name="Monster8" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 80, 336 )
|
||||
animation = "skeletonSoilder"
|
||||
frame = 1
|
||||
|
||||
[node name="Monster5" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 306.1, 464 )
|
||||
frame = 1
|
||||
position = Vector2( 304, 464 )
|
||||
|
||||
[node name="Monster6" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 368, 464 )
|
||||
frame = 1
|
||||
|
||||
[node name="Monster3" parent="Items" instance=ExtResource( 6 )]
|
||||
position = Vector2( 176, 144 )
|
||||
frame = 1
|
||||
|
||||
[node name="Stairs" parent="Items" instance=ExtResource( 3 )]
|
||||
position = Vector2( 48, 144 )
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=21 format=2]
|
||||
[gd_scene load_steps=14 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]
|
||||
@ -11,113 +11,9 @@
|
||||
[ext_resource path="res://src/props/YellowKey.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://src/stairs/StairsUp.tscn" type="PackedScene" id=10]
|
||||
[ext_resource path="res://src/props/BlueDrug.tscn" type="PackedScene" id=11]
|
||||
[ext_resource path="res://assets/images/npcs.png" type="Texture" id=12]
|
||||
[ext_resource path="res://src/npc/HelpEscape.gd" type="Script" id=13]
|
||||
[ext_resource path="res://src/npc/ThiefNpc.tscn" type="PackedScene" id=12]
|
||||
[ext_resource path="res://src/monster/Monster.tscn" type="PackedScene" id=14]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16, 16 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 12 )
|
||||
region = Rect2( 0, 64, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 12 )
|
||||
region = Rect2( 32, 64, 32, 32 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=4]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 2 ), SubResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "thief",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="Animation" id=5]
|
||||
resource_name = "leave"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 48, 400 ), Vector2( 48, 464 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0.5, 1 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"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=6]
|
||||
length = 1.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"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 )
|
||||
|
||||
@ -186,29 +82,14 @@ position = Vector2( 48, 464 )
|
||||
[node name="MonsterSprite" parent="Items" instance=ExtResource( 14 )]
|
||||
position = Vector2( 208, 176 )
|
||||
animation = "blueGuard"
|
||||
frame = 0
|
||||
|
||||
[node name="MonsterSprite2" parent="Items" instance=ExtResource( 14 )]
|
||||
position = Vector2( 272, 176 )
|
||||
animation = "blueGuard"
|
||||
frame = 0
|
||||
|
||||
[node name="Thief" type="StaticBody2D" parent="."]
|
||||
position = Vector2( 112, 336 )
|
||||
script = ExtResource( 13 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Thief"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="Thief"]
|
||||
frames = SubResource( 4 )
|
||||
animation = "thief"
|
||||
playing = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Thief"]
|
||||
anims/leave = SubResource( 5 )
|
||||
anims/open_door = SubResource( 6 )
|
||||
[node name="Thief" parent="." instance=ExtResource( 12 )]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 48, 176 )
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=18 format=2]
|
||||
[gd_scene load_steps=19 format=2]
|
||||
|
||||
[ext_resource path="res://src/level/LevelInstance.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/navigation/NavigationTileMap.gd" type="Script" id=2]
|
||||
@ -16,6 +16,7 @@
|
||||
[ext_resource path="res://src/props/BlueGemstone.tscn" type="PackedScene" id=14]
|
||||
[ext_resource path="res://src/props/RedGemstone.tscn" type="PackedScene" id=15]
|
||||
[ext_resource path="res://src/monster/Monster.tscn" type="PackedScene" id=16]
|
||||
[ext_resource path="res://src/npc/BookNpc.tscn" type="PackedScene" id=17]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 0, 0.1 )
|
||||
@ -92,31 +93,32 @@ position = Vector2( 368, 464 )
|
||||
|
||||
[node name="MonsterSprite" parent="Items" instance=ExtResource( 16 )]
|
||||
position = Vector2( 240, 272 )
|
||||
frame = 1
|
||||
|
||||
[node name="MonsterSprite2" parent="Items" instance=ExtResource( 16 )]
|
||||
position = Vector2( 112, 272 )
|
||||
animation = "bat"
|
||||
frame = 0
|
||||
frame = 1
|
||||
|
||||
[node name="MonsterSprite6" parent="Items" instance=ExtResource( 16 )]
|
||||
position = Vector2( 336, 176 )
|
||||
animation = "bat"
|
||||
frame = 0
|
||||
frame = 1
|
||||
|
||||
[node name="MonsterSprite3" parent="Items" instance=ExtResource( 16 )]
|
||||
position = Vector2( 48, 208 )
|
||||
animation = "bluePriest"
|
||||
frame = 0
|
||||
frame = 1
|
||||
|
||||
[node name="MonsterSprite5" parent="Items" instance=ExtResource( 16 )]
|
||||
position = Vector2( 336, 368 )
|
||||
animation = "bluePriest"
|
||||
frame = 0
|
||||
frame = 1
|
||||
|
||||
[node name="MonsterSprite4" parent="Items" instance=ExtResource( 16 )]
|
||||
position = Vector2( 48, 336 )
|
||||
animation = "skeleton"
|
||||
frame = 0
|
||||
frame = 1
|
||||
|
||||
[node name="YellowDoor5" parent="Items" instance=ExtResource( 8 )]
|
||||
position = Vector2( 304, 464 )
|
||||
@ -139,6 +141,8 @@ position = Vector2( 80, 176 )
|
||||
[node name="RedGemstone" parent="Items" instance=ExtResource( 15 )]
|
||||
position = Vector2( 80, 400 )
|
||||
|
||||
[node name="BookNpc" parent="Items" instance=ExtResource( 17 )]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 80, 464 )
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
[ext_resource path="res://src/monster/monster_spriteframes.tres" type="SpriteFrames" id=8]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 8, 8 )
|
||||
extents = Vector2( 15.9, 15.9 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=2]
|
||||
animations = [ {
|
||||
@ -25,7 +25,6 @@ animations = [ {
|
||||
]]
|
||||
frames = ExtResource( 8 )
|
||||
animation = "greenSlime"
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="Monster" type="StaticBody2D" parent="."]
|
||||
|
22
src/npc/BookNpc.tscn
Normal file
22
src/npc/BookNpc.tscn
Normal file
@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/npc/GiveBook.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/npc/npc_spriteframes.tres" type="SpriteFrames" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 16, 16 )
|
||||
|
||||
[node name="BookNpc" type="StaticBody2D"]
|
||||
position = Vector2( 368, 240 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
frames = ExtResource( 2 )
|
||||
animation = "old_man"
|
||||
playing = true
|
6
src/npc/GiveBook.gd
Normal file
6
src/npc/GiveBook.gd
Normal file
@ -0,0 +1,6 @@
|
||||
extends StaticBody2D
|
||||
|
||||
func on_player_touched(player):
|
||||
yield(Messages.showDialog("我给你怪物手册 它能预测出当前楼层各类怪物对你的伤害"),"hide")
|
||||
player.add_prop("book")
|
||||
queue_free()
|
@ -1,54 +1,98 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://assets/images/npcs.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/npc/npc_spriteframes.tres" type="SpriteFrames" id=1]
|
||||
[ext_resource path="res://src/npc/HelpEscape.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16, 16 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 64, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 32, 64, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 32, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=6]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 32, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=7]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 32, 32, 32, 32 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=8]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 2 ), SubResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "thief",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 4 ), SubResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "old_man",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 6 ), SubResource( 7 ) ],
|
||||
"loop": true,
|
||||
"name": "business_man",
|
||||
"speed": 5.0
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "leave"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 48, 400 ), Vector2( 48, 464 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0.5, 1 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"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"
|
||||
} ]
|
||||
}
|
||||
|
||||
[node name="ThiefNpc" type="StaticBody2D"]
|
||||
[sub_resource type="Animation" id=3]
|
||||
length = 1.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"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="Thief" type="StaticBody2D"]
|
||||
position = Vector2( 112, 336 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
@ -57,7 +101,10 @@ __meta__ = {
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
frames = SubResource( 8 )
|
||||
frames = ExtResource( 1 )
|
||||
animation = "thief"
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/leave = SubResource( 2 )
|
||||
anims/open_door = SubResource( 3 )
|
||||
|
32
src/npc/npc_spriteframes.tres
Normal file
32
src/npc/npc_spriteframes.tres
Normal file
@ -0,0 +1,32 @@
|
||||
[gd_resource type="SpriteFrames" load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://assets/images/npcs.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 32, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 64, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 32, 64, 32, 32 )
|
||||
|
||||
[resource]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 3 ), SubResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": "old_man",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 1 ), SubResource( 2 ) ],
|
||||
"loop": true,
|
||||
"name": "thief",
|
||||
"speed": 5.0
|
||||
} ]
|
@ -19,6 +19,8 @@ export var yellow_key : int = 0 setget set_yellow_key
|
||||
export var blue_key : int = 0 setget set_blue_key
|
||||
|
||||
export var red_key : int = 0 setget set_red_key
|
||||
# 拥有的道具
|
||||
export var props : Array = []
|
||||
|
||||
var navigation_tile_map : NavigationTileMap
|
||||
|
||||
@ -35,6 +37,7 @@ signal money_changed(money)
|
||||
signal yellow_key_changed(yellow_key)
|
||||
signal blue_key_changed(blue_key)
|
||||
signal red_key_changed(red_key)
|
||||
signal prop_added(prop_name)
|
||||
|
||||
func _ready():
|
||||
self.add_to_group("serializable")
|
||||
@ -98,7 +101,8 @@ func save_data(data:Dictionary,global:Dictionary):
|
||||
global.player.money = money
|
||||
global.player.yellow_key = yellow_key
|
||||
global.player.blue_key = blue_key
|
||||
global.player.red_key = red_key
|
||||
global.player.red_key = red_key
|
||||
global.player.props = props
|
||||
data.player_position = position
|
||||
|
||||
# 还原游戏数据
|
||||
@ -112,6 +116,10 @@ func load_data(data:Dictionary,global:Dictionary):
|
||||
self.yellow_key = global.player.yellow_key
|
||||
self.blue_key = global.player.blue_key
|
||||
self.red_key = global.player.red_key
|
||||
self.props = global.player.props
|
||||
#通知
|
||||
for prop in self.props:
|
||||
emit_signal("prop_added",prop)
|
||||
|
||||
func set_hp(value):
|
||||
hp = value
|
||||
@ -140,4 +148,8 @@ func set_blue_key(value):
|
||||
func set_red_key(value):
|
||||
red_key = value
|
||||
emit_signal("red_key_changed",value)
|
||||
|
||||
|
||||
# 增加道具
|
||||
func add_prop(name:String)->void:
|
||||
self.props.append(name)
|
||||
emit_signal("prop_added",name)
|
||||
|
Loading…
Reference in New Issue
Block a user