diff --git a/components/Abstracts/EffectBase.tscn b/components/Abstracts/EffectBase.tscn new file mode 100644 index 0000000..7863c86 --- /dev/null +++ b/components/Abstracts/EffectBase.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=3 format=3 uid="uid://bcvuuy2m0pke0"] + +[ext_resource type="Script" path="res://scripts/Statemachine/EffectController.gd" id="1_pt2rk"] + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_tgxns"] +particle_flag_disable_z = true +gravity = Vector3(0, 98, 0) + +[node name="EffectBase" type="Node2D"] +script = ExtResource("1_pt2rk") + +[node name="particles" type="GPUParticles2D" parent="."] +unique_name_in_owner = true +amount = 30 +process_material = SubResource("ParticleProcessMaterial_tgxns") +explosiveness = 1.0 diff --git a/components/Abstracts/EntityBase.tscn b/components/Abstracts/EntityBase.tscn index 52a1619..9049fc5 100644 --- a/components/Abstracts/EntityBase.tscn +++ b/components/Abstracts/EntityBase.tscn @@ -84,12 +84,22 @@ blend_point_1/node = SubResource("AnimationNodeAnimation_611yr") blend_point_1/pos = 1.0 snap = 1.0 -[sub_resource type="RectangleShape2D" id="RectangleShape2D_ce3to"] -size = Vector2(64, 14) +[sub_resource type="CircleShape2D" id="CircleShape2D_34h7q"] [node name="EntityBase" type="CharacterBody2D"] script = ExtResource("1_mvol6") +[node name="sounds" type="Node2D" parent="."] +unique_name_in_owner = true + +[node name="attack" type="AudioStreamPlayer2D" parent="sounds"] + +[node name="sprint" type="AudioStreamPlayer2D" parent="sounds"] + +[node name="miss" type="AudioStreamPlayer2D" parent="sounds"] + +[node name="hurt" type="AudioStreamPlayer2D" parent="sounds"] + [node name="texture" type="AnimatedSprite2D" parent="."] unique_name_in_owner = true position = Vector2(0, -50) @@ -117,9 +127,6 @@ parameters/blend_position = 1.0 [node name="weapons" type="Node2D" parent="texture"] unique_name_in_owner = true -[node name="movebox" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_ce3to") - [node name="statebar" parent="." instance=ExtResource("2_uje1g")] unique_name_in_owner = true position = Vector2(0, -100) @@ -127,3 +134,7 @@ position = Vector2(0, -100) [node name="damageAnchor" type="Node2D" parent="statebar"] unique_name_in_owner = true position = Vector2(0, -20) + +[node name="movebox" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_34h7q") +disabled = true diff --git a/components/Bullets/HenBomb.tscn b/components/Bullets/HenBomb.tscn new file mode 100644 index 0000000..c577e38 --- /dev/null +++ b/components/Bullets/HenBomb.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=3 uid="uid://dm6viyjsje6yj"] + +[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_2l75q"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_q8kgb"] +radius = 60.0 + +[node name="HenBomb" instance=ExtResource("1_2l75q")] +fields = { +0: 10, +1: 5, +2: 0 +} +lifeTime = 100.0 + +[node name="hitbox" parent="." index="1"] +shape = SubResource("CircleShape2D_q8kgb") diff --git a/components/Characters/Chick.tscn b/components/Characters/Chick.tscn index 1610a11..b3ade38 100644 --- a/components/Characters/Chick.tscn +++ b/components/Characters/Chick.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=7 format=3 uid="uid://b0ncrvm8u4pox"] +[gd_scene load_steps=8 format=3 uid="uid://b0ncrvm8u4pox"] [ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_goqmy"] [ext_resource type="Script" path="res://scripts/Contents/Characters/Chick.gd" id="2_r6bub"] [ext_resource type="Texture2D" uid="uid://7pkplcqqxvnp" path="res://resources/characters/chick/chick-a.svg" id="2_syddq"] [ext_resource type="Texture2D" uid="uid://dj5dvqb8gsedr" path="res://resources/characters/chick/chick-b.svg" id="3_064jv"] +[ext_resource type="AudioStream" uid="uid://b7pxuov1id0ho" path="res://resources/sounds/effect/Pew.mp3" id="3_ik1xf"] +[ext_resource type="PackedScene" uid="uid://dny25qkcvtaa2" path="res://components/Effects/FirePot.tscn" id="6_kvx3n"] [sub_resource type="SpriteFrames" id="SpriteFrames_xji3d"] animations = [{ @@ -27,14 +29,15 @@ animations = [{ "speed": 5.0 }] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_rn84j"] -size = Vector2(19.5, 14) - [node name="Chick" instance=ExtResource("1_goqmy")] script = ExtResource("2_r6bub") +cooldownUnit = 200.0 displayName = "小鸡" -[node name="texture" parent="." index="0"] +[node name="hurt" parent="sounds" index="3"] +stream = ExtResource("3_ik1xf") + +[node name="texture" parent="." index="1"] position = Vector2(0, -37) sprite_frames = SubResource("SpriteFrames_xji3d") animation = &"walk" @@ -42,8 +45,7 @@ animation = &"walk" [node name="normal" type="Node2D" parent="texture/weapons" index="0"] position = Vector2(30, -12) -[node name="movebox" parent="." index="1"] -shape = SubResource("RectangleShape2D_rn84j") +[node name="firepot" parent="texture/weapons/normal" index="0" instance=ExtResource("6_kvx3n")] [node name="statebar" parent="." index="2" node_paths=PackedStringArray("entity")] position = Vector2(0, -82) diff --git a/components/Characters/Hen.tscn b/components/Characters/Hen.tscn index 2dd987c..66ec900 100644 --- a/components/Characters/Hen.tscn +++ b/components/Characters/Hen.tscn @@ -1,5 +1,52 @@ -[gd_scene load_steps=2 format=3 uid="uid://c8h1abpbe6cww"] +[gd_scene load_steps=8 format=3 uid="uid://c8h1abpbe6cww"] [ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_twxai"] +[ext_resource type="Script" path="res://scripts/Contents/Characters/Hen.gd" id="2_8u5a0"] +[ext_resource type="Texture2D" uid="uid://b5m0fpg3ewfum" path="res://resources/characters/hen/hen-a.svg" id="2_k7xxq"] +[ext_resource type="Texture2D" uid="uid://3o0oqobnr3b2" path="res://resources/characters/hen/hen-b.svg" id="3_cpiwr"] +[ext_resource type="AudioStream" uid="uid://cxhsnyjhrnicl" path="res://resources/sounds/effect/Glug.wav" id="3_ojyt7"] -[node name="EntityBase" instance=ExtResource("1_twxai")] +[sub_resource type="SpriteFrames" id="SpriteFrames_xwexj"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("2_k7xxq") +}], +"loop": true, +"name": &"idle", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": ExtResource("2_k7xxq") +}, { +"duration": 1.0, +"texture": ExtResource("3_cpiwr") +}], +"loop": true, +"name": &"walk", +"speed": 5.0 +}] + +[sub_resource type="CircleShape2D" id="CircleShape2D_0uubu"] +radius = 40.0 + +[node name="Hen" instance=ExtResource("1_twxai")] +script = ExtResource("2_8u5a0") +cooldownUnit = 500.0 + +[node name="hurt" parent="sounds" index="3"] +stream = ExtResource("3_ojyt7") + +[node name="texture" parent="." index="1"] +sprite_frames = SubResource("SpriteFrames_xwexj") +animation = &"walk" + +[node name="hitbox" parent="texture/hurtbox" index="0"] +shape = SubResource("CircleShape2D_0uubu") + +[node name="normal" type="Node2D" parent="texture/weapons" index="0"] + +[node name="statebar" parent="." index="2" node_paths=PackedStringArray("entity")] +position = Vector2(0, -114) +entity = NodePath("..") diff --git a/components/Characters/Rooster.tscn b/components/Characters/Rooster.tscn index e7172cd..3f1b563 100644 --- a/components/Characters/Rooster.tscn +++ b/components/Characters/Rooster.tscn @@ -1,9 +1,13 @@ -[gd_scene load_steps=7 format=3 uid="uid://bm7ymrri6pykb"] +[gd_scene load_steps=11 format=3 uid="uid://bm7ymrri6pykb"] [ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"] [ext_resource type="Script" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"] [ext_resource type="Texture2D" uid="uid://fn8qx72clh38" path="res://resources/characters/cock/rooster-a.svg" id="2_q0j6j"] +[ext_resource type="AudioStream" uid="uid://dclinyhu256xi" path="res://resources/sounds/effect/Low Whoosh.mp3" id="3_4syso"] [ext_resource type="Texture2D" uid="uid://ci2ik43ce82uy" path="res://resources/characters/cock/rooster-b.svg" id="3_b0fgx"] +[ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"] +[ext_resource type="AudioStream" uid="uid://dmxh3bpk8vyy5" path="res://resources/sounds/effect/Coin.mp3" id="5_xnbhq"] +[ext_resource type="AudioStream" uid="uid://des7x0l4f3ijc" path="res://resources/sounds/effect/Low Boing.mp3" id="6_nmmw2"] [sub_resource type="SpriteFrames" id="SpriteFrames_4v2ol"] animations = [{ @@ -32,8 +36,21 @@ radius = 41.0122 [node name="Rooster" instance=ExtResource("1_e5pl8")] script = ExtResource("2_oqdqd") +cooldownUnit = 200.0 -[node name="texture" parent="." index="0"] +[node name="attack" parent="sounds" index="0"] +stream = ExtResource("3_4syso") + +[node name="sprint" parent="sounds" index="1"] +stream = ExtResource("4_66s6c") + +[node name="miss" parent="sounds" index="2"] +stream = ExtResource("5_xnbhq") + +[node name="hurt" parent="sounds" index="3"] +stream = ExtResource("6_nmmw2") + +[node name="texture" parent="." index="1"] position = Vector2(0, -70) sprite_frames = SubResource("SpriteFrames_4v2ol") animation = &"walk" diff --git a/components/Effects/FirePot.tscn b/components/Effects/FirePot.tscn new file mode 100644 index 0000000..741fa47 --- /dev/null +++ b/components/Effects/FirePot.tscn @@ -0,0 +1,52 @@ +[gd_scene load_steps=11 format=3 uid="uid://dny25qkcvtaa2"] + +[ext_resource type="PackedScene" uid="uid://bcvuuy2m0pke0" path="res://components/Abstracts/EffectBase.tscn" id="1_k7ukc"] + +[sub_resource type="Curve" id="Curve_ohc88"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_6awim"] +curve = SubResource("Curve_ohc88") + +[sub_resource type="Gradient" id="Gradient_14cxb"] +colors = PackedColorArray(0.780392, 0.498039, 0, 1, 1, 0, 0, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_2p6rn"] +gradient = SubResource("Gradient_14cxb") + +[sub_resource type="Gradient" id="Gradient_g8be5"] +offsets = PackedFloat32Array(0, 0.5, 1) +colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_miml8"] +gradient = SubResource("Gradient_g8be5") + +[sub_resource type="Curve" id="Curve_qy5ym"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_wcx7i"] +curve = SubResource("Curve_qy5ym") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_pah3d"] +particle_flag_disable_z = true +angle_min = 1.07288e-05 +angle_max = 360.0 +direction = Vector3(0, -1, 0) +spread = 15.0 +initial_velocity_min = 10.0 +initial_velocity_max = 300.0 +gravity = Vector3(0, 0, 0) +scale_min = 2.0 +scale_max = 12.0 +scale_over_velocity_curve = SubResource("CurveTexture_wcx7i") +color_ramp = SubResource("GradientTexture1D_miml8") +color_initial_ramp = SubResource("GradientTexture1D_2p6rn") +alpha_curve = SubResource("CurveTexture_6awim") + +[node name="FirePot" instance=ExtResource("1_k7ukc")] + +[node name="particles" parent="." index="0"] +amount = 50 +process_material = SubResource("ParticleProcessMaterial_pah3d") diff --git a/components/Scenes/World.tscn b/components/Scenes/World.tscn index aef7ccf..6e7adcd 100644 --- a/components/Scenes/World.tscn +++ b/components/Scenes/World.tscn @@ -1,11 +1,14 @@ -[gd_scene load_steps=5 format=3 uid="uid://dmxi1ikn6avig"] +[gd_scene load_steps=7 format=3 uid="uid://dmxi1ikn6avig"] [ext_resource type="Script" path="res://scripts/Tools/WorldTool.gd" id="1_t2xvy"] [ext_resource type="PackedScene" uid="uid://dfwg750a47ggx" path="res://components/Scenes/UI.tscn" id="2_04cdd"] [ext_resource type="PackedScene" uid="uid://bm7ymrri6pykb" path="res://components/Characters/Rooster.tscn" id="3_5ui6q"] [ext_resource type="PackedScene" uid="uid://b0ncrvm8u4pox" path="res://components/Characters/Chick.tscn" id="4_tnil0"] +[ext_resource type="PackedScene" uid="uid://c8h1abpbe6cww" path="res://components/Characters/Hen.tscn" id="5_i6i4p"] +[ext_resource type="Texture2D" uid="uid://ckk8kahhof06u" path="res://resources/maps/Castle 2.png" id="6_p0nkj"] [node name="world" type="Node2D"] +y_sort_enabled = true script = ExtResource("1_t2xvy") [node name="UI" parent="." instance=ExtResource("2_04cdd")] @@ -13,6 +16,20 @@ script = ExtResource("1_t2xvy") [node name="rooster" parent="." groups=["players"] instance=ExtResource("3_5ui6q")] position = Vector2(394, 274) -[node name="chick" parent="." groups=["mobs"] instance=ExtResource("4_tnil0")] -position = Vector2(644, 391) +[node name="camera" type="Camera2D" parent="rooster"] +position = Vector2(0, -100) +process_callback = 0 +position_smoothing_enabled = true + +[node name="hen" parent="." groups=["mobs"] instance=ExtResource("5_i6i4p")] +position = Vector2(210, 455) +displayName = "母鸡" + +[node name="Chick" parent="." instance=ExtResource("4_tnil0")] +position = Vector2(788, 513) isBoss = true + +[node name="Castle2" type="Sprite2D" parent="."] +z_index = -1 +position = Vector2(468, 320) +texture = ExtResource("6_p0nkj") diff --git a/project.godot b/project.godot index 8c17c7f..30fedff 100644 --- a/project.godot +++ b/project.godot @@ -48,7 +48,7 @@ attack={ } sprint={ "deadzone": 0.5, -"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) ] } diff --git a/resources/maps/Castle 2.png b/resources/maps/Castle 2.png new file mode 100644 index 0000000..f055bc0 Binary files /dev/null and b/resources/maps/Castle 2.png differ diff --git a/resources/maps/Castle 2.png.import b/resources/maps/Castle 2.png.import new file mode 100644 index 0000000..fe72f8c --- /dev/null +++ b/resources/maps/Castle 2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ckk8kahhof06u" +path="res://.godot/imported/Castle 2.png-663e6bba591a3d6f2a38c2831fd42d19.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/maps/Castle 2.png" +dest_files=["res://.godot/imported/Castle 2.png-663e6bba591a3d6f2a38c2831fd42d19.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/resources/sounds/effect/Boing.mp3 b/resources/sounds/effect/Boing.mp3 new file mode 100644 index 0000000..d46df8f Binary files /dev/null and b/resources/sounds/effect/Boing.mp3 differ diff --git a/resources/sounds/effect/Boing.mp3.import b/resources/sounds/effect/Boing.mp3.import new file mode 100644 index 0000000..210ddbc --- /dev/null +++ b/resources/sounds/effect/Boing.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://cdrevrq7n6yqa" +path="res://.godot/imported/Boing.mp3-74e4a1e999b15b8d3c889d5740f1f6c0.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/Boing.mp3" +dest_files=["res://.godot/imported/Boing.mp3-74e4a1e999b15b8d3c889d5740f1f6c0.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/resources/sounds/effect/Clang.mp3 b/resources/sounds/effect/Clang.mp3 new file mode 100644 index 0000000..305ba1d Binary files /dev/null and b/resources/sounds/effect/Clang.mp3 differ diff --git a/resources/sounds/effect/Clang.mp3.import b/resources/sounds/effect/Clang.mp3.import new file mode 100644 index 0000000..2ccc7fd --- /dev/null +++ b/resources/sounds/effect/Clang.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://d1yo3qlbn1x7i" +path="res://.godot/imported/Clang.mp3-50876f7cd677edbdcd443fa2ca647905.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/Clang.mp3" +dest_files=["res://.godot/imported/Clang.mp3-50876f7cd677edbdcd443fa2ca647905.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/resources/sounds/effect/Coin.mp3 b/resources/sounds/effect/Coin.mp3 new file mode 100644 index 0000000..6beeda2 Binary files /dev/null and b/resources/sounds/effect/Coin.mp3 differ diff --git a/resources/sounds/effect/Coin.mp3.import b/resources/sounds/effect/Coin.mp3.import new file mode 100644 index 0000000..29a4ed4 --- /dev/null +++ b/resources/sounds/effect/Coin.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://dmxh3bpk8vyy5" +path="res://.godot/imported/Coin.mp3-bf58a1b56744f630ff9a0d80910b40a7.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/Coin.mp3" +dest_files=["res://.godot/imported/Coin.mp3-bf58a1b56744f630ff9a0d80910b40a7.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/resources/sounds/effect/Glug.wav b/resources/sounds/effect/Glug.wav new file mode 100644 index 0000000..69409a6 Binary files /dev/null and b/resources/sounds/effect/Glug.wav differ diff --git a/resources/sounds/effect/Glug.wav.import b/resources/sounds/effect/Glug.wav.import new file mode 100644 index 0000000..3cce0bd --- /dev/null +++ b/resources/sounds/effect/Glug.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cxhsnyjhrnicl" +path="res://.godot/imported/Glug.wav-ce11d03274f16f0f59e3f2ff49b8bace.sample" + +[deps] + +source_file="res://resources/sounds/effect/Glug.wav" +dest_files=["res://.godot/imported/Glug.wav-ce11d03274f16f0f59e3f2ff49b8bace.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/resources/sounds/effect/Low Boing.mp3 b/resources/sounds/effect/Low Boing.mp3 new file mode 100644 index 0000000..68049f6 Binary files /dev/null and b/resources/sounds/effect/Low Boing.mp3 differ diff --git a/resources/sounds/effect/Low Boing.mp3.import b/resources/sounds/effect/Low Boing.mp3.import new file mode 100644 index 0000000..859c0af --- /dev/null +++ b/resources/sounds/effect/Low Boing.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://des7x0l4f3ijc" +path="res://.godot/imported/Low Boing.mp3-0d7a95e69d755f2863239a9cb4083223.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/Low Boing.mp3" +dest_files=["res://.godot/imported/Low Boing.mp3-0d7a95e69d755f2863239a9cb4083223.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/resources/sounds/effect/Low Whoosh.mp3 b/resources/sounds/effect/Low Whoosh.mp3 new file mode 100644 index 0000000..a206804 Binary files /dev/null and b/resources/sounds/effect/Low Whoosh.mp3 differ diff --git a/resources/sounds/effect/Low Whoosh.mp3.import b/resources/sounds/effect/Low Whoosh.mp3.import new file mode 100644 index 0000000..94f7f10 --- /dev/null +++ b/resources/sounds/effect/Low Whoosh.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://dclinyhu256xi" +path="res://.godot/imported/Low Whoosh.mp3-7e831f304ce5d24d5ec76a59c516c660.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/Low Whoosh.mp3" +dest_files=["res://.godot/imported/Low Whoosh.mp3-7e831f304ce5d24d5ec76a59c516c660.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/resources/sounds/effect/Pew.mp3 b/resources/sounds/effect/Pew.mp3 new file mode 100644 index 0000000..4b62bff Binary files /dev/null and b/resources/sounds/effect/Pew.mp3 differ diff --git a/resources/sounds/effect/Pew.mp3.import b/resources/sounds/effect/Pew.mp3.import new file mode 100644 index 0000000..ece0253 --- /dev/null +++ b/resources/sounds/effect/Pew.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://b7pxuov1id0ho" +path="res://.godot/imported/Pew.mp3-f95c3f433a0fb10603c74a8216172756.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/Pew.mp3" +dest_files=["res://.godot/imported/Pew.mp3-f95c3f433a0fb10603c74a8216172756.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/scripts/Contents/Characters/Chick.gd b/scripts/Contents/Characters/Chick.gd index 4cf4705..fa6691e 100644 --- a/scripts/Contents/Characters/Chick.gd +++ b/scripts/Contents/Characters/Chick.gd @@ -4,7 +4,7 @@ class_name Chick var angle = 0 func _ready(): fields[FieldStore.Entity.MAX_HEALTH] = 1000 - fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.25 + fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.1 super._ready() func ai(): diff --git a/scripts/Contents/Characters/Hen.gd b/scripts/Contents/Characters/Hen.gd new file mode 100644 index 0000000..831328b --- /dev/null +++ b/scripts/Contents/Characters/Hen.gd @@ -0,0 +1,15 @@ +extends EntityBase +class_name Hen + +func _ready(): + fields[FieldStore.Entity.MAX_HEALTH] = 75 + fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.25 + super._ready() + +func ai(): + move(currentFocusedBoss.position - position) + tryAttack(0) +func attack(type): + if type == 0: + var weaponPos = findWeaponAnchor("normal") + BulletBase.generate(preload("res://components/Bullets/HenBomb.tscn"), self, weaponPos, 0) diff --git a/scripts/Contents/Characters/Rooster.gd b/scripts/Contents/Characters/Rooster.gd index 55f2fc7..bb9103b 100644 --- a/scripts/Contents/Characters/Rooster.gd +++ b/scripts/Contents/Characters/Rooster.gd @@ -22,4 +22,4 @@ func sprint(): move(Vector2( Input.get_axis("m_left", "m_right"), Input.get_axis("m_up", "m_down") - ) * 8, true) + ) * sprintMultiplier, true) diff --git a/scripts/Statemachine/EffectController.gd b/scripts/Statemachine/EffectController.gd new file mode 100644 index 0000000..9349864 --- /dev/null +++ b/scripts/Statemachine/EffectController.gd @@ -0,0 +1,17 @@ +extends Node2D +class_name EffectController + +@export var oneShot: bool = true + +@onready var particles: GPUParticles2D = $"%particles" + +func _ready(): + particles.emitting = false + particles.one_shot = oneShot +func shot(): + var cloned = particles.duplicate() as GPUParticles2D + cloned.emitting = true + add_child(cloned) + if oneShot: + await cloned.finished + cloned.queue_free() diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index e3d4675..492888a 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -10,15 +10,17 @@ var fields = { FieldStore.Entity.CRIT_DAMAGE: 1, FieldStore.Entity.PENERATE: 0, } -var cooldownUnit: float = 100 # 100毫秒每次攻击 +@export var cooldownUnit: float = 100 # 100毫秒每次攻击 @export var isBoss: bool = false @export var displayName: String = "未知实体" +@export var sprintMultiplier: float = 7 @onready var animatree: AnimationTree = $"%animatree" @onready var texture: AnimatedSprite2D = $"%texture" @onready var hurtbox: Area2D = $"%hurtbox" @onready var statebar: EntityStateBar = $"%statebar" +@onready var sounds: Node2D = $"%sounds" var health: float = 0 @@ -47,8 +49,10 @@ func _physics_process(_delta: float) -> void: move_and_slide() # 通用方法 +func displace(direction: Vector2, isSprinting: bool = false): + return (direction if isSprinting else direction.normalized()) * fields.get(FieldStore.Entity.MOVEMENT_SPEED) * 400 * abs(animatree.get("parameters/blend_position")) func move(direction: Vector2, isSprinting: bool = false): - velocity = (direction if isSprinting else direction.normalized()) * fields.get(FieldStore.Entity.MOVEMENT_SPEED) * 200 * abs(animatree.get("parameters/blend_position")) + velocity = displace(direction, isSprinting) var currentDirection = sign(direction.x) if currentDirection != 0: lastDirection = currentDirection @@ -56,7 +60,10 @@ func takeDamage(bullet: BulletBase, crit: bool): var baseDamage: float = bullet.fields.get(FieldStore.Bullet.DAMAGE) * randf_range(1 - GameRule.damageOffset, 1 + GameRule.damageOffset) var damage = baseDamage + baseDamage * int(crit) * fields.get(FieldStore.Entity.CRIT_DAMAGE) if sprinting: + playSound("miss") damage = 0 + else: + playSound("hurt") health -= damage DamageLabel.create(damage, crit, $"%damageAnchor".global_position + MathTool.randv2_range(GameRule.damageLabelSpawnOffset)) if isBoss: @@ -75,9 +82,11 @@ func startCooldown(): func tryAttack(type: int): var state = startCooldown() if state: + playSound("attack") attack(type) return state func trySprint(): + playSound("sprint") sprint() sprinting = true func findWeaponAnchor(weaponName: String): @@ -90,6 +99,14 @@ func setBoss(boss: EntityBase): currentFocusedBoss = boss if isPlayer(): UIState.bossbar.entity = boss +func playSound(type: String): + var body = sounds.get_node_or_null(type) + if body is AudioStreamPlayer2D: + var cloned = body.duplicate() as AudioStreamPlayer2D + add_child(cloned) + cloned.play() + await cloned.finished + cloned.queue_free() # 关于分组 func isPlayer():