PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Question about pixel checking

I asked this once before but didn't get a full answer.

If I print to screen a sprite's location it will say x= 150.4545353 and y = 45.3434334.

The problem is, If I want to sprite to do something when it hits, say 180 on the y axis, the code will never fire because of the decimal point. Thus I always have to Trunc() the x & y to figure out where i am. Is there not an easier way? I would like to just put:

if (x == 120)
Do whatever;
end;
I'd do something like x => 180 instead of x == 180- that's what I've used in my games. Obviously there are a few situations where that won't work. Getting the actual pixel (0-320, 0-240) might also be a possibility too.