This commit is contained in:
2026-01-17 13:59:18 -06:00
parent c46afdac76
commit fbc4e070da
10 changed files with 145 additions and 52 deletions

View File

@@ -2,9 +2,48 @@ class_name BattleScene extends Node3D
@export var actionBox:ActionBox = null
signal neverEmitted
func _init() ->void:
BATTLE.battleScene = self
BATTLE.battleStarted.connect(onBattleStarted)
func onBattleStarted() -> void:
pass
func getBattleDecisions(fighters:Array[BattleFighter]) -> Array[BattleDecision]:
var decisions:Array[BattleDecision] = []
while fighters.size() > decisions.size():
var fighter = fighters[decisions.size()]
var decision:BattleDecision = null
# Simulate walking forward animation like in Final Fantasy
await get_tree().create_timer(0.5).timeout
# Until decision made...
while decision == null:
# Get the selected action
actionBox.visible = true
var action = await self.actionBox.getAction(fighter)
# Go back to previous fighter
if action == ActionBox.Action.BACK:
decisions.pop_back()
actionBox.visible = false
break
elif action == ActionBox.Action.ATTACK:
var targets = await _getTargets(fighter, fighter.movePrimary)
actionBox.visible = false
if decision != null:
decisions.append(decision)
# Return the made decision
return decisions
func _getTargets(fighter:BattleFighter, move:BattleAction) -> Array[BattleFighter]:
print("Determining target")
await neverEmitted
return []