Box spawn item problem

Get help using Construct 2

Post » Fri Feb 06, 2015 8:45 am

ok here is what I'm stuck on I have one sprite Call wooden box and when you destroy it, it will spawn a loot.

Now i want to add in random loot.

The problem is when i have multiple wooden box to destroy it will spawn both item instead of just one to spawn.

My question is this is there a Condition that allows me to let the code work individual for each new sprite instead of looping it all to that one same sprite causing my code an spawn object to change every time i kill a new box
B
51
S
24
G
6
Posts: 391
Reputation: 7,810

Post » Fri Feb 06, 2015 9:20 am

First you have to be sure right box is picked beforehand by condition.
Then you can either put all loot in 1 family and then spawn family (which will give you one random object in that family), or you can use compare variable with random number and else:
You do not have the required permissions to view the files attached to this post.
B
12
S
6
G
2
Posts: 99
Reputation: 1,727

Post » Fri Feb 06, 2015 11:40 am

Family is the best way to spawn random object
B
18
S
3
G
3
Posts: 109
Reputation: 2,784

Post » Fri Feb 06, 2015 12:50 pm

But with random numbers you can adjust chance of each object to appear. For example if you want speed power up to appear twice as often as shield power up.
B
12
S
6
G
2
Posts: 99
Reputation: 1,727


Return to How do I....?

Who is online

Users browsing this forum: gokusatu, Yahoo [Bot] and 3 guests