#Most efficient workflow for Godot?

2 messages · Page 1 of 1 (latest)

prime osprey
#

During the programming of my game on the Godot engine, it seems like there has been a lot of boilerplate stuff and some weird practices I keep doing.
First, in almost every single script, I have to yield on idle because children nodes in globals aren't ready, and sometimes I have to add more than two for some odd reason?
Second I have been just trying to get setters to not error out because they are usually called before onready even happens, which requires more idle_frames to be used.
Third, I have a lot of scenes in my projects, and a lot of them depend on each other. I have to keep all my scenes open in the editor just so the code intellisense works properly, it seems like one in vscode works better? other times, the node paths, or the intellisense just doesn't work at all?
Even with always bypassing or ignoring these issues, I feel like most of the time, my code has been just trying to make sure the nodes are available for use, or me slapping on onready and idle_frames in a lot of areas?
Fourth, sometimes I have to make major changes to some of my scene structures, when they have to be inherited, I have to copy all the nodes from that scene into a new scene just so I can get inheritance on that scene.

Do you guys know of any efficient workflows in Godot that I might be missing out on?

#
onready var health_progress_bar_node = find_node('ProgressBar')
onready var coin_label_node = find_node('CoinLabel')

signal health_changed
var health = 100 setget set_health
func set_health(val):
  health = val
  emit_signal('health_changed')
  if !health_progress_bar_node:
    yield(get_tree(), 'idle_frame')

func _ready():
  # These are required because children nodes in globals aren't ready yet
  yield(get_tree(), 'idle_frame')
  yield(get_tree(), 'idle_frame')

  Global.game.coin_storage.connect('coins_changed', self, '_on_coins_changed')

func _on_coins_changed():
  coin_label.text = 'Coins: %s' % [Global.game.coin_storage.coins]

its fine doing like for one script, but i have been doing stuff like this from throughout a hundred of scripts