How do I use array to spawn monsters

Get help using Construct 2

Post » Fri Oct 10, 2014 3:02 pm

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.
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 36
Reputation: 452

Post » Sat Oct 11, 2014 10:27 am

bumping in hopes of a reply
B
6
S
1
Posts: 36
Reputation: 452

Post » Sat Oct 11, 2014 2:21 pm

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.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sun Oct 12, 2014 4:03 am

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.
B
6
S
1
Posts: 36
Reputation: 452


Return to How do I....?

Who is online

Users browsing this forum: Blendi1223 and 16 guests