How do I

Get help using Construct 2

Post » Mon Aug 31, 2015 1:40 pm

Hi,

How do I spawn an object, randomly picked from my 10 different sprites. Is there a simple tutorial for this.

I see in the manual that I can use 'FAMILY' which requires a C2 license. Is there a long way to do this as I am not yet sure that C2 is right for me or if I have the ability to learn this program.

Thank you.
B
6
S
1
Posts: 6
Reputation: 419

Post » Mon Aug 31, 2015 2:12 pm

@Delsetray, it is much easier using a Family...

but without Family, I would create a global variable, and set it to a random number between 1 and 10 and then create a sprite for each possible result:

SpawnNumber = Round(Random(1,10))

Then

System Compare Variable -> SpawnNumber = 1 -> System Create Object -> Sprite1 on layer 0 at x , y
System Compare Variable -> SpawnNumber = 2 -> System Create Object -> Sprite2 on layer 0 at x , y
System Compare Variable -> SpawnNumber = 3 -> System Create Object -> Sprite3 on layer 0 at x , y
.
.
.
System Compare Variable -> SpawnNumber = 10 -> System Create Object -> Sprite10 on layer 0 at x , y


Note: you would want to have all those lines be sub-events of some code that decides when you need to spawn a sprite. If they were top level events they would continuously spawn sprites as long as the global variable has a value...
B
98
S
35
G
20
Posts: 438
Reputation: 17,875

Post » Tue Sep 01, 2015 5:13 am

Thank you so much, I will work on that.

Del
B
6
S
1
Posts: 6
Reputation: 419


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 21 guests