0 votes

https://godotengine.org/qa/105314/how-to-instance-for-every-count-of-an-element-inside-an-array this is the same i don't know what happened...
This is how I make the arrays, I don't know where i'm wrong

var elements = [1,2,3]
var contain_elements = []

func _physics_process(delta):

func _spawn_aqua_elements():
    for i in contain_elements:
        i = elements[1]
        var aquabo = contain_elements.count(i)
        if aquabo == 0:
            for x in range(aquabo):
                var aqua = preload("res://Entities/Player/Scenes/THREE/Aqua.tscn").instance()
                aqua.transform = get_parent().global_transform

if Input.is_action_just_pressed("aqua"): #WATER
    contain_elements.insert(contain_elements.size() , 2)

func _check_elements():
    if contain_elements.size() > 3:
in Engine by (46 points)

1 Answer

0 votes


The continue keyword will skip to the next iteration of the for loop. That means that the inner for loop will never run. I think you have it indented one tab too much.

by (8,150 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.