How do I round numbers to the nearest multiple

Get help using Construct 2

Post » Thu Oct 02, 2014 1:36 pm

What I need to know is how to round the Sprite.X of an object to the nearest multiple of 80. For example if Sprite.X = 76 I want it to round up to 80 or if Sprite.X = 178 i want it to round down to 160. I know round(Player.X) rounds the number to a whole number but i need it to round to the nearest 80.

Thanks :}
B
8
S
3
G
2
Posts: 52
Reputation: 1,762

Post » Thu Oct 02, 2014 1:43 pm

round(Sprite.X/80)*80
ImageImageImage
B
71
S
21
G
222
Posts: 3,652
Reputation: 124,733

Post » Fri Oct 03, 2014 6:26 am

thankyou very much
B
8
S
3
G
2
Posts: 52
Reputation: 1,762


Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests