How do I use array to spawn monsters

0 favourites
  • 4 posts
From the Asset Store
241 high-quality monstrous sounds that will make the audio of your project more cool.
  • What I want to do is get the array to choose a random sprite object to spawn. I have searched for examples but haven't had luck finding anything that I can make sense of. I want row 1 of the array to pick from 5 sprite monsters to spawn for game level 1-10. Then I would like the 2nd row of array to pick from 5 sprite monsters for game level 11-20 and so on. I'm not even sure if this is what i need to get this to work. If anyone can give me an example of how this can be done it would help me understand way better than reading from manual or tutorial. I will add my .capx that I want the array added to. Right now I have a function spawning the monsters but I can't get it to spawn certain sprites for certain levels.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • bumping in hopes of a reply

  • First, switch your random() action to: int(random(0,3)). This gives an even chance of each number. round(random(0,2)) doesn't.

    You can also use choose: choose(0,1,2). You could have different choose() lines for different levels if you can't get arrays to work.

    Arrays will work, but this might be easier to understand.

  • I gave up on the array for now and just made the monsters lvl up and get hps for each level. Thanks for the advice I'll see what i can do with it. I'd still like to see someone post an example of the array though just so i'll know how it works.

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