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
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Sun Apr 05, 2015 8:04 pm

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

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
71
S
19
G
8
Posts: 640
Reputation: 9,701


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests