Space randomly spawned objects evenly

Get help using Construct 2

Post » Thu Jul 11, 2013 9:47 pm

I have objects spawning with the same y value, and a randomly generated x value (0,700). I would like these to spawn only on increments of 50. I know math round rounds to the nearest decimal.... is it possible to have something round to an arbitrary increment like this?
B
5
S
1
G
1
Posts: 18
Reputation: 566

Post » Thu Jul 11, 2013 11:12 pm

x = self.x - (self.x % 50)

% is modulo which will get the remainder after you divide by that number, so it will return the amount of pixels it is past an increment of 50.
B
44
S
13
G
7
Posts: 603
Reputation: 7,936

Post » Fri Jul 12, 2013 7:59 pm

Worked perfectly- thanks!
B
5
S
1
G
1
Posts: 18
Reputation: 566


Return to How do I....?

Who is online

Users browsing this forum: ijust8, imhotep22, tetuan, Yahoo [Bot] and 2 guests