Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Drachenbauer |
Still i use this to iterate an array of instances backwards:
var size = group_node.get_children().size()
for i in range(size - 1, -1, -1):
if group_node.get_children()[i].level > 0:
G.curency += group_node.get_children()[i].units_second
return
to find the last one, that is already leveled in the game and use it to add a matching value to the curency.
but is there also another way?
one, that is more like:
for instance in group_node.get_children():
if instance.level > 0:
G.curency += instance.units_second
That the variable, that is declared in the for-line here “instance”, directly holds an instance from these children and not just a number. but this goes forward