ZainWD

Untitled

Apr 15th, 2021 (edited)
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extends Node2D
  2.  
  3. onready var turn_queue: TurnQueue = $TurnQueue
  4. onready var player_actions = $CanvasLayer/PlayerActions
  5.  
  6. var active := false
  7.  
  8. # Called when the node enters the scene tree for the first time.
  9. func _ready():
  10.     print("test1")
  11.     player_actions.hide()
  12.     var battlers = turn_queue.get_children()
  13.     for battler in battlers:
  14.         battler.initialize()
  15.     turn_queue.initialize()
  16.     print("test2")
  17.     play_intro()
  18.     play_turn()
  19.  
  20. func play_intro():
  21.     print("test3")
  22.     for battler in turn_queue.get_children():
  23.         battler.appear()
  24.         print("test4")
  25.  
  26. func play_turn():
  27.     var battler: Battler = get_active_battler()
  28.     var targets: Array
  29.     var action: BattleAction
  30.    
  31.     while not battler.can_move():
  32.         turn_queue.skip_turn()
  33.         battler = get_active_battler()
  34.    
  35.     battler.selected = true
  36. #   Insert block here where the enemies are obtained based off if the current
  37. #   battler is playable or not, and call an end battle function if there are
  38. #   no enemies
  39.    
  40.     battler.selected = false
  41.    
  42.     turn_queue.play_turn(action, targets)
  43.     if active:
  44.         play_turn()
  45.  
  46. func get_active_battler() -> Battler:
  47.     return turn_queue.active_battler
  48.  
  49.  
Add Comment
Please, Sign In to add comment