1
\$\begingroup\$

I'm trying to create an isometric tile-based game (for iPhone) and I'm having trouble with height in tiles.

What I currently do (without heights) is apply some mathematic transformations to my 2D-matrix (which represent the tiles) so that I know where in the screen (x,y) should I place the isometric tile. Then, when the user clicks somewhere in the screen, I take that values and pass them through a function (kind of f^-1) to get which tile it belongs to.

This works perfectly. My problem is: imagine that I want some tiles to have a different height from others. In order to draw the tile itself its pretty simple, since the z-coordinate has no transformation in the isometric approach used in games (z'=z). BUT what if I want to calculate the tile coordinate (defined by X-tile and Y-tile) from the touch coordinates (x,y)? Any guess?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Keep a z coordinate and make the x and y its actual x and y positions. the drawn position will be affected by the z coordinate. make sure the check tile pressed event also takes the new z variable into account and then all you will have to do is check what the x y value is after you figure out what tile was clicked.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .