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
+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: