Make research tree vertically scrollable

This commit is contained in:
Loïc Wisniewski 2026-08-13 16:25:41 +02:00
commit 13492a52e2
6 changed files with 70 additions and 13 deletions

View file

@ -105,6 +105,24 @@ func _process(delta: float) -> bool:
print("TEST_SKILL_TREE: FAIL (mothership has no research action)")
quit(1)
return true
# The tree is a tall, vertically scrolling canvas. A branch keeps a
# stable lane as it rises, and dragging exposes higher depths.
var freight: Vector2 = controller.skill_tree.node_screen_pos(game_state.skill_node("freight"))
var yards: Vector2 = controller.skill_tree.node_screen_pos(game_state.skill_node("freight_yards"))
if absf(freight.x - yards.x) > 1.0 or yards.y >= freight.y:
print("TEST_SKILL_TREE: FAIL (freight branch does not rise vertically)")
quit(1)
return true
var before_scroll: float = controller.skill_tree.scroll_y
var drag: InputEventScreenDrag = InputEventScreenDrag.new()
# Start at the root at the bottom; pull the canvas down to reveal
# the branches rising above it.
drag.relative = Vector2(0.0, 180.0)
controller.skill_tree.handle_drag(drag)
if controller.skill_tree.scroll_y >= before_scroll:
print("TEST_SKILL_TREE: FAIL (tree did not scroll upward)")
quit(1)
return true
# --- prerequisites --------------------------------------------
if game_state.can_unlock("wing"):