Zoom and precision tapping

Hello everyone!

I’ve picked up the trial version of Corona and am trying to set up basic functions to support isometry to test out the framework before buying a copy.

I want my isometric grid to be zoomable and scrollable, which I have achieved with ease. However, my isometric cells must also respond to tap events.

I set up an isometric cell as a cell outline, created with display.newLine, and an image created with display.newImage (displaying a predrawn isometric cell).

Obviously, the images of isometric cells overlap, and when a cell that is surrounded by other cells is tapped, several tap events are generated, and I need to filter out the cells for which images were clicked, but outside the visible area (to find out which cell was truly tapped).

My first attempt at solving this problem was to explicitly check if the tap is within the area of the outline - by creating functions for each tile that returned if a specific coordinate lies within the tile. The problem with this is accounting for the transformations that I apply to the group that contains my isometric cells. Also, manually doing inverse transformation math for every time a cell is tapped seems excessive, especially since it’s already done for the image automatically.
So, my problem is this: I need a good way to precisely check which isometric cells were tapped, despite their transformations. By “precisely check” I mean determine of the visible area of an isometric cell was clicked (and not just it’s 2D-Image bounding-box).

Any help with finding the best solution to this problem would be highly welcome, as isometry is essential to the games I plan on writing with Corona.

[import]uid: 8145 topic_id: 1698 reply_id: 301698[/import]

I’ve skipped this part and continued to work on the rest of my project, and I find I need to know which part of the tile was hit anyway. So I’d most appreciate a solution that would allow me to find the coordinates of the hit image relative to it’s center, or something analogous.

(my game needs to feature objects that can be placed in quadrants of tiles; tiles are units of interaction with the user, but quadrants are units of pathfinding and object placement) [import]uid: 8145 topic_id: 1698 reply_id: 4969[/import]

can you create a proxy that allows you to map from your isometric cell to a hit test rather than creating a touch event for each cell?

for example, a while back i was trying to create a grid, and each cell when clicked on displayed a new image. well, after x number of cells and x number of screens, it became absurd to have x * x number of hit cell areas.

what i did, was created a proxy, a rectangle that i could map the x and y to the cell ( as the cell was fixed size) and then map it against a table that index into the right screen . that worked like a charm.

sounds to me that you could do the same.

c

[import]uid: 24 topic_id: 1698 reply_id: 5017[/import]