Hey everyone, this is from a question in my 'Isometric Stuff' thread in 'Your Creations', I figured I would be better off putting in here.
Basically, I want pixel perfect collisions in isometric space. The isometric example that rojohound put up was great, but it wasn't pixel perfect. By that I mean, when something collides with something else, I want them sitting hard up against each other with no space in between.
Now my objects all have 'bounding box' variables, so their shape and size is defined by numbers.
They also have a 'flag' to test if they're moving or not, they have an 'xVelocity' and 'yVelocity' variable (zVelocity later ) which is how many pixels the object will move along the isometric X or Y axis the next tick (It's usually a decimal number as it uses timedelta).
I can already successfully test whether or not an object is colliding, the only problem I'm having is getting it to sit still and hard up against the object it's colliding with
Here's one of my versions of it:
Note: The family variables, 'realX' and 'realY' are just there to record the fractional XY co-ordinates, if I could find a way to do this reliably without them, I would love to!
If I use the actual XY co-ordinates to move them, due to the rounding involved, it makes slow movement impossible.
I've tried various approaches, moving the object, checking for collision, moving it back 1 pixel in the direction it came from until it is no longer colliding etc, but nothing seems to work properly. This could be due to the wrong events on my part, which is why I WOULD LOVE ANY HELP ON THIS!
Thanks to everyone in advance!