I recently discovered the class_name keyword which is useful for autocompleting specific variables in a user-defined class.
E.g.:
if I have a class_name Enemy
and Enemy has variable health
, I can use function signature to autocomplete the variable names:
func attackEnemy(e, dmg):
e.health -= dmg #"health" will not autocomplete
func attackEnemy(e : Enemy, dmg):
e.health -= dmg #"health" will autocomplete
Now, I want to expand that signature usage to more complex things like this:
func attackManyEnemies(arrayOfEnemies, dmg):
for e in arrayOfEnemies:
e.health -= dmg
However, the engine does not want me to add a signature like arrayOfEnemies : Array[Enemy]
. While I can sign an argument as an Array, that is not helpful because it does not tell the syntax checker anything about what is inside the array