round , floor and cieling

Quote:

*Originally posted by zoranvedek *

**How do I get an object in motion to go to the nearest 25(i.e. 25, 50, 75, 100, etc.)when it stops? I've been playing with the 'round' function(I am getting the objects postion 'pos' then setting its position and rounding it 'pos Round(25)'), but apparently I am doing it wrong, as the edit box I have monitoring its position shows it landing nowhere near the nearest '25'.**

Any help greatly appreciated.

-Jason

Round is used as Round(pos) which will round it to the nearest integer number only. Floor does the same but always rounds down and cieling always rounds up. This is not going to work for what you are trying to do.

I'm sure we can work it out though. What is the largest multiple of 25 you'll need to check for?

using javascript you could do this:

&& means AND

|| means OR

-------------

Code:

if (pos<25 || pos>25 && pos<38){

pos=25;

}

if (pos>25 && pos>38){

pos = 50;

}

and so on