How do I create multiple enemies trough code?

0 favourites
  • 3 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi there, I'm looking for a way to create multiple enemies at one time. All my tries have failed, sometimes I crashed the game.

    My game makes use of rounds, I want the number of rounds to be the number of enemies created, I tried a lot of things that would make sense but I guess I do something wrong.

    Does anyone know how I can do this?

    ===========================================================================================================

    While -> enemy.count = 0 and rounds >= enemy.count

    create enemy

    ===========================================================================================================

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This is all that's needed to do what you are asking.

    If you are causing the game to crash, you are most likely creating an infinite loop. You need to make sure your loop exit condition can be reached. I prefer for loops. They are much harder to create an infinite loop in.

  • This is all that's needed to do what you are asking.

    If you are causing the game to crash, you are most likely creating an infinite loop. You need to make sure your loop exit condition can be reached. I prefer for loops. They are much harder to create an infinite loop in.

    Thanks for your help, now my code works perfectly!

    I'll remember the tip you gave me about loops.

    Thanks again for your time and afford to help me.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)