How do I spawn a lot of enemies

0 favourites
  • 6 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • Hey guys,

    I am working at a game where a lot of enemie's are spawn from the top of the layout (out of another object) but i am not sure how to do it. I know how to spawn an object out of another object but in this case it is kinda more complicated.

    I have some enemies and i want them to be spawn in a certain order at a certain time (so not at random) during a level. i also do not want them to fall down all at the same timing (like every 2 seconds or so) and also not in the same order.

    Is there a best way to do this in construct 2? maybe with an array or something?

    I hope i don't have to build a thousand lines in my event sheet

    It is kinda difficult to explain, i hope you understand what i mean.

    Thanks, Manny

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It would be easier to answer your question if you told more about what you do want instead of what you don't..

    What is the setup you are using right now, what kind of timing would you like?

    If you don't want random, you could use a timer and/or condition based spawning..

  • Well, i have a couple ob object at the top of my layout to spawn objects. These are enemies that you need to hit (touch) to kill them en friends you need to avoid hitting. Let's say i have 4 types of enemie sprites and 4 types of friend sprites.

    These have all the physics behaviors so they will fall down from the top till the bottom (and then gets destroyed outside the layout)

    Now i want the enemies and friends all to fall down in a certain order (like enemy 1, 3, 2, 1, 4, 2 etc).

    Yes a timer is a possibility but can i let some objects fall down at different timing, like the first object falls after 2 seconds and then the next after 1 and then the next after 3 etc?

    I can do it random but i want the level to be the same every time you'll open it up again.

    I'll hope you'll understand what i mean.

    Thanks for your time and response

  • With a timer you can time things, so yes, the time can be different..

    if you want an order of things to fall, you could just do it with a textvariable

    "1;5;3;4;2;1;5;4:3"

    set nextspawn to int(tokenat(textvariable,0,";")

    set textvariable to right(textvariable,2*tokencount(textvariable)-1)

    I guess you could do timing intervals in exactly the same way..

  • i'm sorry but i can't figure out how that works in construct 2.

    Can you tell me which event i need to get nextspawn and where i can fill in my textvariable?

    I know to give my enemy/friend objects a variable name/value, but not how to call them in a specific order.

  • When you create a variable, you can set it's value inside the editor.

    You could also create an action to set the variable.

    I don't know which conditions you need for your event so I'd have to guess..

    something like:

    on timer

    (subevent)

    if nextspawn = 1

    create enemy1

    if nextspawn = 2

    create enemy 2

    (empty)

    set nextspawn to int(tokenat(textvariable,0,";")

    -set textvariable to right(textvariable,2*tokencount(textvariable)-1)

    -start timer for random(1,4)

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