0 votes

Hello!

I'm working on a zombie project game and I was wondering if it would be possible to instance 2 things at once without doing it really fast in _process(delta).

Ex: var E = enemy.instance() # is it possible to instance 2 here instead of one?

or

Ex: add_child(enemy) # is it possible to add 2 child's to the scene instead of one?

Instead of copying and pasting the whole instancing.

Any ideas/Help would be awesome c:

in Engine by (23 points)

use a for loop?

What do you mean with "without doing it really fast"?

Something like using a timer, spawn when starts and on timeout?

there will be no time to run any other codes if you let them.
as @whooshfrosted, @eons said,
if you run this,

var E = enemy.instance()
add_child(E)

no other things can't be run during running this 2 codes.

if you do this below, nothing can happen but enemy is generated eternally and will get only not respond message from OS.

while true:
    var E = enemy.instance()
    add_child(E)
  • what are you trying to do?
  • what did you expect?
  • what is your problem?

you can use for loop, if condition, while, or just copy and paste the code//

Please log in or register to answer this question.

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.