# isometric game area problem

Printable View

• Dec 20th 2012, 09:02 AM
Hexidecimentalist
isometric game area problem
helloooo. i am totally new here and not strictly from strong maths background so bear with me.

im trying to make an isometric videogame, and there comes a point where i need to determine which of the game floor tiles the mouse is hovering over fomr the mouse x,y.

the problem is i need to determine the top left x,y value of a sprite when the mouse is over it, but only within the actual tile shape itself not the mask area of the sprite.

the dimensions are thus:
sprite height 32 pixels, width 64 pixels, the pixels numbers start at 0 rather than 1 from the top left of the sprite, and the actual shape of the tile is a diamond pointed at the middle two pixels of each horizontal and vertical face.

please can someone point me in the right direction, my brain hurts
• Dec 20th 2012, 10:12 PM
chiro
Re: isometric game area problem
Hey Hexidecimentalist.

What shape is your mask? Is it a rectangle or a general shape?
• Dec 26th 2012, 02:33 AM
Hexidecimentalist
Re: isometric game area problem
Hi chiro, thanks.Sorry it took me so long to respond, the festive season leaves me little time for geek fun :(.

the mask is a general shape, but the shape itself is constant between tile sprites. heres the sprite and the mask,

Attachment 26357 Attachment 26358

and the sprite again pixel by pixel

Attachment 26359

so, with the shape being constant, surely it is possible to return the top left x,y coords of the sprite from x,y coords taken from inside the polygon?
• Dec 26th 2012, 03:39 AM
chiro
Re: isometric game area problem
Have you tried applying bit-wise AND masks and then checked what the value of the first non-zero bit is under some constraints?