1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-11 06:07:12 +08:00

feat: 添加新武器彩虹旗和紫水晶簇,调整饲料属性和数值

refactor: 重构子弹生成逻辑,支持分裂和折射效果

fix: 修复掉落物拾取范围和碰撞检测问题

style: 优化UI显示,添加武器品质和类型标签

docs: 更新字段描述,调整部分饲料名称和分类

perf: 优化数学工具函数,添加随机数处理工具

test: 调整波次生成逻辑,添加新敌人类型

build: 添加新资源文件和相关导入配置
This commit is contained in:
2025-09-05 22:23:41 +08:00
parent bb279c99b0
commit d4501ae45d
54 changed files with 974 additions and 109 deletions
+16 -14
View File
@@ -10,32 +10,34 @@ var collecting: bool = false
@onready var animator: AnimationPlayer = $"%animator"
func _ready():
apply_force(MathTool.randv2_range(30000), MathTool.randv2_range(10))
await TickTool.millseconds(100)
body_entered.connect(
func(body):
if body is ItemDropped and !body.collecting:
if body.item == item:
body.stackCount += stackCount
collect()
)
func _process(_delta):
texture.texture = ItemStore.getTexture(item)
func _physics_process(_delta):
if !is_instance_valid(targetPlayer):
targetPlayer = findPlayer()
targetPlayer = EntityTool.findClosetPlayer(position, WorldManager.tree)
if is_instance_valid(targetPlayer):
if collecting:
linear_velocity = Vector2.ZERO
else:
var direction = (targetPlayer.position - position).normalized()
var speed = 5000.0 / ((targetPlayer.position - position).length() ** (1 / 3.0))
var speed = 10000.0 / ((targetPlayer.position - position).length() ** (1 / 3.0))
apply_central_force(direction * speed)
angular_velocity = linear_velocity.length() ** (1.0 / 2.25) # 角速度=线速度的2.25次根号
if position.distance_to(targetPlayer.position) < targetPlayer.fields.get(FieldStore.Entity.DROPPED_ITEM_COLLECT_RADIUS):
targetPlayer.collectItem(item, stackCount)
collect()
if targetPlayer.sprinting:
apply_central_force((position - targetPlayer.texture.global_position).normalized() * targetPlayer.velocity.length() * 10)
else:
targetPlayer.collectItem(item, stackCount)
collect()
func findPlayer() -> EntityBase:
var result = null
var lastDistance = INF
for player in get_tree().get_nodes_in_group("players"):
if player is EntityBase:
if position.distance_to(player.position) < lastDistance:
lastDistance = position.distance_to(player.position)
result = player
return result
func collect():
collecting = true
animator.play("collect")