mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-23 03:52:30 +08:00
feat(UI): 添加游戏开始界面和难度选择功能
实现游戏开始界面,包含难度选择滑块和开始按钮 修改游戏规则初始难度为10并调整掉落物品数量计算 添加游戏开始条件检查,确保运行时间超过3秒且没有敌人时显示制作饲料界面
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
@tool
|
||||
extends FullscreenPanelBase
|
||||
|
||||
@onready var diffEdit: HSlider = $"%diffEdit"
|
||||
@onready var startBtn: Button = $"%startBtn"
|
||||
@onready var levelShow: Label = $"%levelShow"
|
||||
|
||||
func _ready():
|
||||
startBtn.pressed.connect(
|
||||
func():
|
||||
Wave.next()
|
||||
UIState.closeCurrentPanel()
|
||||
)
|
||||
func _physics_process(_delta):
|
||||
levelShow.text = "%s/10" % diffEdit.value
|
||||
GameRule.difficulty = diffEdit.value
|
||||
@@ -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
|
||||
|
||||
@@ -19,6 +19,7 @@ func _ready():
|
||||
energyPercent = $"%percent"
|
||||
itemCollect = $"%itemCollect"
|
||||
skillIconContainer = $"%skillContainer"
|
||||
setPanel("Starter")
|
||||
func _process(_delta):
|
||||
bossbar.visible = !!bossbar.entity
|
||||
func _physics_process(_delta):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class_name GameRule
|
||||
|
||||
static var deadReasons: Array = JsonTool.parseJson("res://resources/constants/deadReasons.json")
|
||||
static var difficulty: float = 1 # 难度倍数,可以写小数
|
||||
static var difficulty: float = 10 # 难度倍数,可以写小数
|
||||
static var allowFriendlyFire: bool = false # 是否允许友军伤害
|
||||
static var bulletSpeedMultiplier: float = 1 # 子弹速度倍率
|
||||
static var damageOffset: float = MathTool.percent(20) # 伤害随机浮动比例
|
||||
|
||||
@@ -8,10 +8,9 @@ static var runningTime: int = 0
|
||||
func _ready():
|
||||
tree = get_tree()
|
||||
rootNode = self
|
||||
print(GameRule.deadReasons)
|
||||
func _physics_process(delta):
|
||||
runningTime += delta * 1000
|
||||
if EntityBase.mobCount() == 0:
|
||||
if EntityBase.mobCount() == 0 and runningTime > 3000:
|
||||
UIState.setPanel("MakeFeed")
|
||||
|
||||
static func getTime():
|
||||
|
||||
Reference in New Issue
Block a user