Help on random?

Get help using Construct 2

Post » Sun Apr 05, 2015 7:29 pm

I have an event on start of layout, set value RandomNumber to random(1-5). Then according to the number picked, spawn a certain sprite. But for some reason it won't spawn anything and I do have an instance of each object. Anyone know why this is happening? Thanks!
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Sun Apr 05, 2015 8:00 pm

int(random(1,6))
ImageImageImage
B
71
S
21
G
203
Posts: 3,584
Reputation: 115,072

Post » Sun Apr 05, 2015 8:04 pm

Image
B
62
S
23
G
7
Posts: 1,470
Reputation: 10,731

Post » Sun Apr 05, 2015 10:00 pm

How are you handling "according to number picked".. are you assigning the # to a variable then using a spawner system to spawn based on this variable value?
If your picking the number and selecting the objects in the same event it may get wonky.. seems like I ran into that same issue making the shooter in my sig. I ended up making number pickers (I use "choose" 1-10 instead of random.. but its all randoms) and then my spawner events fire off based on results in separate events.

Make a text item on your layout called debug and set it to "set text" whatever your &randomVariable is and you will be able to at least rule out if your randomizer is working.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
60
S
15
G
8
Posts: 620
Reputation: 8,972


Return to How do I....?

Who is online

Users browsing this forum: MuchaDev, tetuan, tikuna and 4 guests