diff --git a/components/Abstracts/BulletBase.tscn b/components/Abstracts/BulletBase.tscn index fa09ef9..0c460b1 100644 --- a/components/Abstracts/BulletBase.tscn +++ b/components/Abstracts/BulletBase.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=6 format=3 uid="uid://crtdkysmnkith"] +[gd_scene load_steps=7 format=3 uid="uid://crtdkysmnkith"] [ext_resource type="Script" path="res://scripts/Statemachine/BulletBase.gd" id="1_pklpq"] @@ -7,8 +7,26 @@ [sub_resource type="Animation" id="Animation_kmogx"] resource_name = "spawn" +[sub_resource type="Animation" id="Animation_ynxlt"] +resource_name = "loop" +loop_mode = 1 +step = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [0.0, 6.28319] +} + [sub_resource type="AnimationLibrary" id="AnimationLibrary_dxweq"] _data = { +"loop": SubResource("Animation_ynxlt"), "spawn": SubResource("Animation_kmogx") } diff --git a/components/Bullets/HenBomb.tscn b/components/Bullets/HenBomb.tscn deleted file mode 100644 index c577e38..0000000 --- a/components/Bullets/HenBomb.tscn +++ /dev/null @@ -1,17 +0,0 @@ -[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/Bullets/Laser.tscn b/components/Bullets/Laser.tscn index 2e1f801..9498625 100644 --- a/components/Bullets/Laser.tscn +++ b/components/Bullets/Laser.tscn @@ -22,7 +22,7 @@ fields = { 1: 15, 2: 1 } -lifeTime = 1000.0 +lifeTime = 2000.0 [node name="texture" parent="." index="0"] rotation = 1.5708 diff --git a/components/Bullets/Pencil.tscn b/components/Bullets/Pencil.tscn index 3658bf9..4a4d614 100644 --- a/components/Bullets/Pencil.tscn +++ b/components/Bullets/Pencil.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_anksp"] [ext_resource type="Script" path="res://scripts/Contents/Bullets/Pencil.gd" id="2_4w6n2"] -[ext_resource type="Texture2D" uid="uid://dnpqfqfg6dwt4" path="res://resources/bullets/pencil/pencil-a.svg" id="2_ks8tb"] +[ext_resource type="Texture2D" uid="uid://dnpqfqfg6dwt4" path="res://resources/bullets/pencil/frames/pencil-a.svg" id="2_ks8tb"] [sub_resource type="SpriteFrames" id="SpriteFrames_7ol02"] animations = [{ @@ -15,6 +15,53 @@ animations = [{ "speed": 5.0 }] +[sub_resource type="Animation" id="Animation_ij0gd"] +length = 0.001 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:scale:y") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath(".:modulate:a") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/3/type = "bezier" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath(".:position:y") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(-44, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} + [sub_resource type="Animation" id="Animation_kmogx"] resource_name = "spawn" step = 0.05 @@ -63,53 +110,6 @@ tracks/3/keys = { "times": PackedFloat32Array(0.75, 1) } -[sub_resource type="Animation" id="Animation_ij0gd"] -length = 0.001 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:scale:x") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath(".:scale:y") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/2/type = "bezier" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath(".:modulate:a") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/3/type = "bezier" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath(".:position:y") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(-44, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_0cgv5"] _data = { "RESET": SubResource("Animation_ij0gd"), @@ -122,6 +122,7 @@ size = Vector2(10, 10) [node name="Pencil" instance=ExtResource("1_anksp")] script = ExtResource("2_4w6n2") lifeTime = 3000.0 +autoSpawnAnimation = true [node name="texture" parent="." index="0"] position = Vector2(0, -44) diff --git a/components/Bullets/Star.tscn b/components/Bullets/Star.tscn new file mode 100644 index 0000000..4a40fcd --- /dev/null +++ b/components/Bullets/Star.tscn @@ -0,0 +1,83 @@ +[gd_scene load_steps=10 format=3 uid="uid://dm6viyjsje6yj"] + +[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_x6yf7"] +[ext_resource type="Texture2D" uid="uid://csdjmin6g22sw" path="res://resources/bullets/star/frames/star.svg" id="2_cke7d"] +[ext_resource type="Script" path="res://scripts/Contents/Bullets/Star.gd" id="2_y4b0l"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_t53gb"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("2_cke7d") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="Animation" id="Animation_kmogx"] +resource_name = "spawn" + +[sub_resource type="Animation" id="Animation_ynxlt"] +resource_name = "loop" +loop_mode = 1 +step = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [0.0, 6.28319] +} + +[sub_resource type="Animation" id="Animation_cig5u"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [4.38234] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_ls1ie"] +_data = { +"RESET": SubResource("Animation_cig5u"), +"loop": SubResource("Animation_ynxlt"), +"spawn": SubResource("Animation_kmogx") +} + +[sub_resource type="CircleShape2D" id="CircleShape2D_tietk"] +radius = 19.2354 + +[node name="Star" instance=ExtResource("1_x6yf7")] +script = ExtResource("2_y4b0l") +fields = { +0: 10, +1: 5, +2: 0 +} +lifeTime = 1000.0 +autoLoopAnimation = true + +[node name="texture" parent="." index="0"] +rotation = 4.38234 +sprite_frames = SubResource("SpriteFrames_t53gb") + +[node name="animator" parent="texture" index="0"] +libraries = { +"": SubResource("AnimationLibrary_ls1ie") +} + +[node name="hitbox" parent="." index="1"] +shape = SubResource("CircleShape2D_tietk") diff --git a/components/Characters/Chick.tscn b/components/Characters/Chick.tscn index 451ac74..e9f9203 100644 --- a/components/Characters/Chick.tscn +++ b/components/Characters/Chick.tscn @@ -32,7 +32,7 @@ animations = [{ [node name="Chick" instance=ExtResource("1_goqmy")] script = ExtResource("2_r6bub") -cooldownUnit = 2000.0 +cooldownUnit = 3000.0 displayName = "小鸡" drops = Array[int]([0, 1]) dropCounts = Array[Vector2]([Vector2(10, 20), Vector2(7, 14)]) diff --git a/components/Characters/Hen.tscn b/components/Characters/Hen.tscn index 4027654..50d70db 100644 --- a/components/Characters/Hen.tscn +++ b/components/Characters/Hen.tscn @@ -33,7 +33,7 @@ radius = 40.0 [node name="Hen" instance=ExtResource("1_twxai")] script = ExtResource("2_8u5a0") -cooldownUnit = 500.0 +cooldownUnit = 1000.0 drops = Array[int]([0, 1]) dropCounts = Array[Vector2]([Vector2(4, 8), Vector2(2, 6)]) energy = 1000.0 diff --git a/components/Feeds/WaterBottle.tscn b/components/Feeds/WaterBottle.tscn index 89a4d74..6ca94cf 100644 --- a/components/Feeds/WaterBottle.tscn +++ b/components/Feeds/WaterBottle.tscn @@ -1,19 +1,18 @@ -[gd_scene load_steps=4 format=3 uid="uid://droytqrm4swm1"] +[gd_scene load_steps=3 format=3 uid="uid://droytqrm4swm1"] [ext_resource type="PackedScene" uid="uid://bykwevnv7keeh" path="res://components/Abstracts/FeedCardBase.tscn" id="1_vfxjq"] -[ext_resource type="Texture2D" uid="uid://bdknu6rkkpoyd" path="res://resources/feeds/fruitsalad.svg" id="2_8w6xu"] [ext_resource type="Texture2D" uid="uid://doyq5mp7wvv7s" path="res://resources/feeds/glass water-a.svg" id="2_gsfud"] [node name="FruitSalad" instance=ExtResource("1_vfxjq")] avatarTexture = ExtResource("2_gsfud") displayName = "一杯水" fields = Array[int]([3]) -fieldValues = Array[float]([0.22]) -costs = Array[int]([0]) -costCounts = Array[int]([400]) +fieldValues = Array[float]([0.25]) +costs = Array[int]([1]) +costCounts = Array[int]([500]) [node name="avatar" parent="container/info" index="0"] -texture = ExtResource("2_8w6xu") +texture = ExtResource("2_gsfud") [node name="name" parent="container/info" index="1"] -text = "[b]水果沙拉[/b]" +text = "[b]一杯水[/b]" diff --git a/resources/bullets/pencil/Chomp.wav.import b/resources/bullets/pencil/Chomp.wav.import new file mode 100644 index 0000000..4bf64aa --- /dev/null +++ b/resources/bullets/pencil/Chomp.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bwq6pb7fhn4hw" +path="res://.godot/imported/Chomp.wav-7095f250875916c0d559e91887d7fc79.sample" + +[deps] + +source_file="res://resources/bullets/pencil/Chomp.wav" +dest_files=["res://.godot/imported/Chomp.wav-7095f250875916c0d559e91887d7fc79.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/bullets/pencil/pencil-a.svg b/resources/bullets/pencil/frames/pencil-a.svg similarity index 100% rename from resources/bullets/pencil/pencil-a.svg rename to resources/bullets/pencil/frames/pencil-a.svg diff --git a/resources/bullets/pencil/pencil-a.svg.import b/resources/bullets/pencil/frames/pencil-a.svg.import similarity index 73% rename from resources/bullets/pencil/pencil-a.svg.import rename to resources/bullets/pencil/frames/pencil-a.svg.import index 8260197..46da646 100644 --- a/resources/bullets/pencil/pencil-a.svg.import +++ b/resources/bullets/pencil/frames/pencil-a.svg.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dnpqfqfg6dwt4" -path="res://.godot/imported/pencil-a.svg-280308b2cbe43bf6b55157df2b4e5c5f.ctex" +path="res://.godot/imported/pencil-a.svg-96396af0fe49ebefbf40b2464d79c347.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://resources/bullets/pencil/pencil-a.svg" -dest_files=["res://.godot/imported/pencil-a.svg-280308b2cbe43bf6b55157df2b4e5c5f.ctex"] +source_file="res://resources/bullets/pencil/frames/pencil-a.svg" +dest_files=["res://.godot/imported/pencil-a.svg-96396af0fe49ebefbf40b2464d79c347.ctex"] [params] diff --git a/resources/bullets/star/frames/star.svg b/resources/bullets/star/frames/star.svg new file mode 100644 index 0000000..9f4f82c --- /dev/null +++ b/resources/bullets/star/frames/star.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/resources/bullets/star/frames/star.svg.import b/resources/bullets/star/frames/star.svg.import new file mode 100644 index 0000000..db57e6f --- /dev/null +++ b/resources/bullets/star/frames/star.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://csdjmin6g22sw" +path="res://.godot/imported/star.svg-436a9060c4ccdd062ecebfeda31fc179.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/bullets/star/frames/star.svg" +dest_files=["res://.godot/imported/star.svg-436a9060c4ccdd062ecebfeda31fc179.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/resources/sounds/effect/Chomp.wav b/resources/sounds/effect/Chomp.wav index fde1183..951b2db 100644 Binary files a/resources/sounds/effect/Chomp.wav and b/resources/sounds/effect/Chomp.wav differ diff --git a/scripts/Contents/Bullets/Diamond.gd b/scripts/Contents/Bullets/Diamond.gd index 2281dd8..5c48b01 100644 --- a/scripts/Contents/Bullets/Diamond.gd +++ b/scripts/Contents/Bullets/Diamond.gd @@ -1,9 +1,9 @@ extends BulletBase class_name Diamond +const traceTime = 1000 + func ai(): - var tracing = timeLived() < 1000 - if tracing: - rotation = lerp_angle(rotation, position.angle_to_point(launcher.currentFocusedBoss.position), 0.1) - canDamageSelf = !tracing + rotation = lerp_angle(rotation, position.angle_to_point(launcher.currentFocusedBoss.position), 0.2 * (traceTime - timeLived())) + canDamageSelf = !(timeLived() >= traceTime) forward(Vector2.from_angle(rotation)) diff --git a/scripts/Contents/Bullets/Laser.gd b/scripts/Contents/Bullets/Laser.gd index ee46b66..e7c1d8e 100644 --- a/scripts/Contents/Bullets/Laser.gd +++ b/scripts/Contents/Bullets/Laser.gd @@ -2,5 +2,5 @@ extends BulletBase class_name Laser func ai(): - rotation_degrees += 2 + rotation_degrees += 5 position = launcher.texture.global_position diff --git a/scripts/Contents/Bullets/Star.gd b/scripts/Contents/Bullets/Star.gd new file mode 100644 index 0000000..d78d93e --- /dev/null +++ b/scripts/Contents/Bullets/Star.gd @@ -0,0 +1,5 @@ +extends BulletBase +class_name Star + +func ai(): + forward(Vector2.from_angle(rotation)) diff --git a/scripts/Contents/Characters/Chick.gd b/scripts/Contents/Characters/Chick.gd index 4b96e89..d274870 100644 --- a/scripts/Contents/Characters/Chick.gd +++ b/scripts/Contents/Characters/Chick.gd @@ -22,13 +22,14 @@ func attack(type): if type == 0: var weaponPos = findWeaponAnchor("normal") for i in randi_range(10, 20): - return BulletBase.generate(preload("res://components/Bullets/Diamond.tscn"), self, weaponPos + MathTool.randv2_range(20), rotation + deg_to_rad(randf_range(-90, 90))) + BulletBase.generate(preload("res://components/Bullets/Diamond.tscn"), self, weaponPos + MathTool.randv2_range(20), rotation + deg_to_rad(randf_range(-90, 90))) elif type == 1: for i in range(laserCount): - return BulletBase.generate(preload("res://components/Bullets/Laser.tscn"), self, texture.global_position, deg_to_rad(90 * i)) + BulletBase.generate(preload("res://components/Bullets/Laser.tscn"), self, texture.global_position, deg_to_rad(90 * i)) elif type == 2: var weaponPos = findWeaponAnchor("normal") var target = weaponPos.angle_to_point(currentFocusedBoss.position) firepot.global_rotation = target firepot.shot() - return BulletBase.generate(preload("res://components/Bullets/FireScan.tscn"), self, weaponPos, target) + BulletBase.generate(preload("res://components/Bullets/FireScan.tscn"), self, weaponPos, target) + return true diff --git a/scripts/Contents/Characters/Hen.gd b/scripts/Contents/Characters/Hen.gd index 9a79829..ba0d34b 100644 --- a/scripts/Contents/Characters/Hen.gd +++ b/scripts/Contents/Characters/Hen.gd @@ -12,4 +12,6 @@ func ai(): func attack(type): if type == 0: var weaponPos = findWeaponAnchor("normal") - return BulletBase.generate(preload("res://components/Bullets/HenBomb.tscn"), self, weaponPos, 0) + for i in randi_range(1, 4): + BulletBase.generate(preload("res://components/Bullets/Star.tscn"), self, weaponPos, randf_range(0, PI * 2)) + return true diff --git a/scripts/Contents/Characters/Rooster.gd b/scripts/Contents/Characters/Rooster.gd index b742d2a..f1f4239 100644 --- a/scripts/Contents/Characters/Rooster.gd +++ b/scripts/Contents/Characters/Rooster.gd @@ -19,8 +19,8 @@ func ai(): func attack(type): if type == 0: var weaponPos = findWeaponAnchor("normal") - return BulletBase.generate(preload("res://components/Bullets/Pencil.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle()) - # return BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle()) + # return BulletBase.generate(preload("res://components/Bullets/Pencil.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle()) + return BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle()) func sprint(): move(Vector2( Input.get_axis("m_left", "m_right"), diff --git a/scripts/Statemachine/BulletBase.gd b/scripts/Statemachine/BulletBase.gd index 106002b..3310850 100644 --- a/scripts/Statemachine/BulletBase.gd +++ b/scripts/Statemachine/BulletBase.gd @@ -10,7 +10,9 @@ class_name BulletBase @export var lifeTime: float = -1 # -1表示无限时间 @export var indisDamage: bool = false # 是否无差别伤害(不区分敌我) @export var canDamageSelf: bool = false # 是否可以伤害发射者 -@export var needEnergy: float = 4.0 # 发射时需要消耗的能量 +@export var needEnergy: float = 0.0 # 发射时需要消耗的能量 +@export var autoSpawnAnimation: bool = false +@export var autoLoopAnimation: bool = false @onready var animator: AnimationPlayer = $"%animator" @onready var hitbox: CollisionShape2D = $"%hitbox" @@ -24,8 +26,12 @@ func _ready(): area_entered.connect(hit) spawnInWhen = Time.get_ticks_msec() spawnInWhere = position - animator.play("spawn") spawn() + if autoSpawnAnimation: + animator.play("spawn") + await animator.animation_finished + if autoLoopAnimation: + animator.play("loop") func _process(_delta: float) -> void: if lifeTime > 0: if Time.get_ticks_msec() - spawnInWhen >= lifeTime: diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index ac4414c..46d0925 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -71,7 +71,7 @@ func _process(_delta): for i in inventory: inventory[i] = clamp(inventory[i], 0, inventoryMax[i]) func _physics_process(_delta: float) -> void: - animatree.set("parameters/blend_position", lerpf(animatree.get("parameters/blend_position"), lastDirection, 0.1)) + animatree.set("parameters/blend_position", lerpf(animatree.get("parameters/blend_position"), lastDirection, 0.2)) if sprinting: velocity *= 0.9 if velocity.length() <= 100: