1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

Refactor and update various components and assets

- Updated WaterBottle scene to change field values and costs, and modified avatar texture and display name.
- Removed unused pencil SVG and its import files.
- Updated Chomp sound effect with a new binary file.
- Modified Diamond bullet behavior to improve tracing logic.
- Increased rotation speed for Laser bullet.
- Adjusted Chick and Hen character attack methods to generate bullets without returning prematurely.
- Updated Rooster character to use PurpleCrystal bullet instead of Pencil.
- Enhanced BulletBase with new properties for energy consumption and animation control.
- Adjusted blend position interpolation in EntityBase for smoother movement.
- Added new Star bullet with its scene and script, including animation setup.
- Updated SVG and import files for new Star bullet graphics.
This commit is contained in:
2025-08-27 15:38:30 +08:00
parent 2e1d15a0a0
commit 1a918a7a14
22 changed files with 259 additions and 93 deletions
+19 -1
View File
@@ -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")
}
-17
View File
@@ -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")
+1 -1
View File
@@ -22,7 +22,7 @@ fields = {
1: 15,
2: 1
}
lifeTime = 1000.0
lifeTime = 2000.0
[node name="texture" parent="." index="0"]
rotation = 1.5708
+49 -48
View File
@@ -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)
+83
View File
@@ -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")
+1 -1
View File
@@ -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)])
+1 -1
View File
@@ -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
+6 -7
View File
@@ -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]"
+24
View File
@@ -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

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

@@ -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]
+7
View File
@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="46.57026815414429" height="45.66248083114624" viewBox="-0.4356868267059326 -0.33834052085876465 46.57026815414429 45.66248083114624">
<!-- Exported by Scratch - http://scratch.mit.edu/ -->
<g id="ID0.4861416635103524">
<path id="Star" fill="#FFFF00" stroke="#000000" stroke-width="1.2878577709197998" d="M 34.2454 43.7816 C 30.9614 45.7649 21.3128 35.5135 21.3128 35.5135 C 21.3128 35.5135 10.0698 43.9954 7.1669 41.484 C 4.2615 38.9727 11.0331 26.6247 11.0331 26.6247 C 11.0331 26.6247 -0.5061 18.5524 0.9852 15.016 C 2.4765 11.4769 16.3107 14.1016 16.3107 14.1016 C 16.3107 14.1016 20.419 0.6332 24.2439 0.9552 C 28.074 1.2797 29.8538 15.2504 29.8538 15.2504 C 29.8538 15.2504 43.9327 14.9954 44.8033 18.7353 C 45.6816 22.4727 32.9447 28.4844 32.9447 28.4844 C 32.9447 28.4844 37.5372 41.7983 34.2454 43.7816 Z "/>
<path id="Star_1_" fill="#FFFFFF" d="M 27.8499 34.0119 C 26.1963 35.0087 21.3462 29.8547 21.3462 29.8547 C 21.3462 29.8547 15.6977 34.1175 14.2398 32.8554 C 12.782 31.5933 16.1819 25.391 16.1819 25.391 C 16.1819 25.391 10.3866 21.3316 11.1335 19.557 C 11.8831 17.7797 18.8323 19.0985 18.8323 19.0985 C 18.8323 19.0985 20.8981 12.3295 22.8221 12.4944 C 24.7436 12.6566 25.6348 19.6755 25.6348 19.6755 C 25.6348 19.6755 32.7129 19.5492 33.1507 21.4269 C 33.5938 23.3072 27.1957 26.3259 27.1957 26.3259 C 27.1957 26.3259 29.4984 33.0151 27.8499 34.0119 Z " stroke-width="2.5757155418395996"/>
</g>
</svg><!--rotationCenter:22:23-->

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -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
Binary file not shown.
+4 -4
View File
@@ -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))
+1 -1
View File
@@ -2,5 +2,5 @@ extends BulletBase
class_name Laser
func ai():
rotation_degrees += 2
rotation_degrees += 5
position = launcher.texture.global_position
+5
View File
@@ -0,0 +1,5 @@
extends BulletBase
class_name Star
func ai():
forward(Vector2.from_angle(rotation))
+4 -3
View File
@@ -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
+3 -1
View File
@@ -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
+2 -2
View File
@@ -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"),
+8 -2
View File
@@ -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:
+1 -1
View File
@@ -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: