From 3c8ec9d039dae31edb1f2629bc9ccfa462599492 Mon Sep 17 00:00:00 2001 From: freewu32 <2217332562@qq.com> Date: Sat, 5 Sep 2020 13:33:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E5=AE=8C=E6=88=90=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=8B=B1=E9=9B=84=E9=87=91=E5=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Main.tscn | 2 +- src/levels/Level4.tscn | 11 ++++++++++ src/monster/Monster.gd | 2 ++ src/npc/BookNpc.tscn | 4 ++-- src/shop/Shop.tscn | 49 +++++++++++++++++++++--------------------- 5 files changed, 40 insertions(+), 28 deletions(-) diff --git a/Main.tscn b/Main.tscn index 45c1321..5ba7706 100644 --- a/Main.tscn +++ b/Main.tscn @@ -28,7 +28,7 @@ region = Rect2( 0, 160, 32, 32 ) [sub_resource type="AtlasTexture" id=5] atlas = ExtResource( 7 ) -region = Rect2( 0, 192, 32, 32 ) +region = Rect2( 0, 224, 32, 32 ) [sub_resource type="StreamTexture" id=6] load_path = "res://.import/icons_old.png-15488db7964fa7b4e69cdc7d96c7bd7f.stex" diff --git a/src/levels/Level4.tscn b/src/levels/Level4.tscn index de01814..9333aeb 100644 --- a/src/levels/Level4.tscn +++ b/src/levels/Level4.tscn @@ -75,43 +75,54 @@ position = Vector2( 80, 144 ) [node name="MonsterSprite" parent="Items" instance=ExtResource( 6 )] position = Vector2( 112, 336 ) +frame = 1 [node name="MonsterSprite4" parent="Items" instance=ExtResource( 6 )] position = Vector2( 144, 464 ) +frame = 1 [node name="MonsterSprite6" parent="Items" instance=ExtResource( 6 )] position = Vector2( 272, 464 ) +frame = 1 [node name="MonsterSprite7" parent="Items" instance=ExtResource( 6 )] position = Vector2( 272, 400 ) animation = "bluePriest" +frame = 1 [node name="MonsterSprite8" parent="Items" instance=ExtResource( 6 )] position = Vector2( 80, 208 ) animation = "bluePriest" +frame = 1 [node name="MonsterSprite9" parent="Items" instance=ExtResource( 6 )] position = Vector2( 304, 272 ) animation = "skeleton" +frame = 1 [node name="MonsterSprite10" parent="Items" instance=ExtResource( 6 )] position = Vector2( 336, 208 ) animation = "skeletonSoilder" +frame = 1 [node name="MonsterSprite5" parent="Items" instance=ExtResource( 6 )] position = Vector2( 112, 432 ) +frame = 1 [node name="MonsterSprite11" parent="Items" instance=ExtResource( 6 )] position = Vector2( 144, 400 ) animation = "bat" +frame = 1 [node name="MonsterSprite2" parent="Items" instance=ExtResource( 6 )] position = Vector2( 48, 336 ) animation = "redSlime" +frame = 1 [node name="MonsterSprite3" parent="Items" instance=ExtResource( 6 )] position = Vector2( 208, 272 ) animation = "redSlime" +frame = 1 [node name="PlayerProps4" parent="Items" instance=ExtResource( 10 )] position = Vector2( 306.1, 432 ) diff --git a/src/monster/Monster.gd b/src/monster/Monster.gd index 93c1d86..31c0fe8 100644 --- a/src/monster/Monster.gd +++ b/src/monster/Monster.gd @@ -26,6 +26,8 @@ func on_player_touched(player): yield(skill_sprite,"animation_finished") #减扣英雄血量 player.hp -= hurt + #增加金币 + player.money += monster_info.money #删除怪物 monster_sprite.queue_free() player.resume() diff --git a/src/npc/BookNpc.tscn b/src/npc/BookNpc.tscn index a5a2b54..daf7387 100644 --- a/src/npc/BookNpc.tscn +++ b/src/npc/BookNpc.tscn @@ -3,7 +3,7 @@ [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] +[sub_resource type="RectangleShape2D" id=1] extents = Vector2( 16, 16 ) [node name="BookNpc" type="StaticBody2D"] @@ -14,7 +14,7 @@ __meta__ = { } [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -shape = SubResource( 2 ) +shape = SubResource( 1 ) [node name="AnimatedSprite" type="AnimatedSprite" parent="."] frames = ExtResource( 2 ) diff --git a/src/shop/Shop.tscn b/src/shop/Shop.tscn index 5043afb..21de25c 100644 --- a/src/shop/Shop.tscn +++ b/src/shop/Shop.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://assets/images/npcs.png" type="Texture" id=4] [ext_resource path="res://assets/fonts/Droid Sans Fallback.ttf" type="DynamicFontData" id=5] -[sub_resource type="RectangleShape2D" id=6] +[sub_resource type="RectangleShape2D" id=1] extents = Vector2( 48, 16 ) [sub_resource type="AtlasTexture" id=2] @@ -29,6 +29,8 @@ animations = [ { size = 12 font_data = ExtResource( 5 ) +[sub_resource type="StyleBoxEmpty" id=6] + [sub_resource type="StyleBoxEmpty" id=7] [sub_resource type="StyleBoxEmpty" id=8] @@ -37,15 +39,13 @@ font_data = ExtResource( 5 ) [sub_resource type="StyleBoxEmpty" id=10] -[sub_resource type="StyleBoxEmpty" id=11] - [node name="Shop" type="StaticBody2D"] position = Vector2( 176, 144 ) script = ExtResource( 3 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2( 32, 0 ) -shape = SubResource( 6 ) +shape = SubResource( 1 ) [node name="Left" type="Sprite" parent="."] texture = ExtResource( 2 ) @@ -65,7 +65,6 @@ region_enabled = true region_rect = Rect2( 0, 736, 32, 32 ) [node name="ShopDialog" type="PopupDialog" parent="."] -visible = true margin_left = -80.0 margin_top = 16.0 margin_right = 146.0 @@ -125,11 +124,11 @@ __meta__ = { margin_top = 8.0 margin_right = 160.0 margin_bottom = 30.0 -custom_styles/hover = SubResource( 7 ) -custom_styles/pressed = SubResource( 8 ) -custom_styles/focus = SubResource( 9 ) -custom_styles/disabled = SubResource( 10 ) -custom_styles/normal = SubResource( 11 ) +custom_styles/hover = SubResource( 6 ) +custom_styles/pressed = SubResource( 7 ) +custom_styles/focus = SubResource( 8 ) +custom_styles/disabled = SubResource( 9 ) +custom_styles/normal = SubResource( 10 ) custom_fonts/font = ExtResource( 1 ) text = "生命+100" @@ -137,11 +136,11 @@ text = "生命+100" margin_top = 38.0 margin_right = 160.0 margin_bottom = 60.0 -custom_styles/hover = SubResource( 7 ) -custom_styles/pressed = SubResource( 8 ) -custom_styles/focus = SubResource( 9 ) -custom_styles/disabled = SubResource( 10 ) -custom_styles/normal = SubResource( 11 ) +custom_styles/hover = SubResource( 6 ) +custom_styles/pressed = SubResource( 7 ) +custom_styles/focus = SubResource( 8 ) +custom_styles/disabled = SubResource( 9 ) +custom_styles/normal = SubResource( 10 ) custom_fonts/font = ExtResource( 1 ) text = "攻击力+2" @@ -149,11 +148,11 @@ text = "攻击力+2" margin_top = 68.0 margin_right = 160.0 margin_bottom = 90.0 -custom_styles/hover = SubResource( 7 ) -custom_styles/pressed = SubResource( 8 ) -custom_styles/focus = SubResource( 9 ) -custom_styles/disabled = SubResource( 10 ) -custom_styles/normal = SubResource( 11 ) +custom_styles/hover = SubResource( 6 ) +custom_styles/pressed = SubResource( 7 ) +custom_styles/focus = SubResource( 8 ) +custom_styles/disabled = SubResource( 9 ) +custom_styles/normal = SubResource( 10 ) custom_fonts/font = ExtResource( 1 ) text = "防御力+4" @@ -161,11 +160,11 @@ text = "防御力+4" margin_top = 98.0 margin_right = 160.0 margin_bottom = 120.0 -custom_styles/hover = SubResource( 7 ) -custom_styles/pressed = SubResource( 8 ) -custom_styles/focus = SubResource( 9 ) -custom_styles/disabled = SubResource( 10 ) -custom_styles/normal = SubResource( 11 ) +custom_styles/hover = SubResource( 6 ) +custom_styles/pressed = SubResource( 7 ) +custom_styles/focus = SubResource( 8 ) +custom_styles/disabled = SubResource( 9 ) +custom_styles/normal = SubResource( 10 ) custom_fonts/font = ExtResource( 1 ) text = "离开" [connection signal="pressed" from="ShopDialog/VBoxContainer/AddHp" to="." method="_on_AddHp_pressed"]