Why my auto-spawnning doesn't work?

Get help using Construct 2

Post » Mon Feb 02, 2015 5:37 pm

Here is "code":

Global variable: Los

- every 1 second
'Set Los to random(1, 2)

- every Tick
- Los =1
'Create ..................
'Set Los to 0

May I forgot about something? Please help!
B
6
Posts: 56
Reputation: 366

Post » Mon Feb 02, 2015 6:03 pm

Use Set Los to floor(random(1,3))
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Mon Feb 02, 2015 6:10 pm

@NormalOne
When you use random()
Its going to randomize a number somewhere between 1 and 2. It will never be 2 and very rarely be 1 because it'll give you numbers between 1 and 2 such as 1.2, 1.4 ,1.5
So in your code your looking for when the number = 1 and this won't happen very often.
It seems like you're looking to do it half the time.
So do what Magistross says, it will still randomize the number the same way but then the floor command will round the number down to a whole number. So if you got 1.2 the expression would evaluate to 1 and then the rest of your code would run.
B
33
S
8
G
2
Posts: 100
Reputation: 2,635


Return to How do I....?

Who is online

Users browsing this forum: bluesun66, Kenthria, Malhog, plinkie, Yahoo [Bot] and 2 guests