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

feat(UI): 添加游戏开始界面和难度选择功能

实现游戏开始界面,包含难度选择滑块和开始按钮
修改游戏规则初始难度为10并调整掉落物品数量计算
添加游戏开始条件检查,确保运行时间超过3秒且没有敌人时显示制作饲料界面
This commit is contained in:
2025-09-12 22:08:55 +08:00
parent 90f7f28649
commit 3171c39915
7 changed files with 83 additions and 7 deletions
+4 -3
View File
@@ -255,7 +255,7 @@ func tryDie(by: BulletBase):
var item = drops[drop]
var count = ceil(randf_range(dropCounts[drop].x, dropCounts[drop].y))
for i in range(count):
ItemDropped.generate(item, randi_range(0, int(sqrt(count))), position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset))
ItemDropped.generate(item, randi_range(1, int(sqrt(count) + GameRule.difficulty)), position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset))
if MathTool.rate(
GameRule.appleDropRate +
by.launcher.fields.get(FieldStore.Entity.DROP_APPLE_RATE) +
@@ -268,10 +268,11 @@ func tryDie(by: BulletBase):
fields[FieldStore.Entity.MAX_HEALTH] * randf_range(1 - GameRule.beachballOffset, 1 + GameRule.beachballOffset),
position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset)
)
if isPlayer():
if UIState.player == self:
UIState.setPanel("GameOver", [displayName, by.launcher.displayName])
EffectController.create(preload("res://components/Effects/DeadBlood.tscn"), texture.global_position).shot()
await die()
if isPlayer() and UIState.player == self:
UIState.setPanel("GameOver", [displayName, by.launcher.displayName])
func tryHeal(count: float):
if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH):
inventory[ItemStore.ItemType.APPLE] -= 1