Imprecise Location at Overlap?

Morning, more Platform here.

When Mario hits a Question Mark Tile, I want to swap it with a plain tile. If Mario hits the tile in the center all is good, but if he hits off center, then the code is changing the Question Mark tile AND the brick next to it. It raises the question, what exactly is location? Is there a more direct way of referencing the block you just hit? Is Mario technically hitting two wall blocks?

It would be really awesome if “overlap wall” allowed you to specify the tile type as well. Wall is very generic. I need my various tiles to be solid and wall seems to be the only way.

Thanks Again

Replace this block with

location == questiontile

This approach tightens up the alignment check…not middle school friendly, but better

If this is what you meant, it does stop the inadvertent changing of the neighboring tile.

But, not sure why this behaves differently. Also, Mario can hit the neighboring tile just off center and trigger the question tile. Still curious about what is considered ‘hitting’…how much of Mario has to be hitting the tile to trigger the overlap? Is one pixel all it takes?

Again, what is location? It is Col and Row or x,y. I could see wanting to compare Mario’s X location to the tile’s X location to tune the actual overlap.

A location is a column + row, so a location always points to a single tile. You can hit multiple tiles at once, but the “location” parameter in the event will always point to the specific tile that the event is running for in this instance. So, you should always use that “location” instead of “tile to top of sprite is ____”.

I believe that “tile to top of sprite is ____” will always choose the tile to the top of the tile that the center of the sprite is in, which will not always be the tile that you are hitting when that event runs. For example, if a sprite is 3/4 between two tiles, when they jump the event will fire twice (once for the left tile, once for the right). However, “tile to top of sprite is ____” will point to same tile for both events (whichever tile the sprite is more inside)