ProgrammingGamer / GodotTestingRepository_01

Just A Repo To Learn Github and Test out Features in Godot
2 stars 0 forks source link

Solving The Concept Of Tile Selection #1

Closed ProgrammingGamer closed 6 years ago

ProgrammingGamer commented 6 years ago

The Basic Idea being that we need to create a system that can interpret pixel coordinates and associate them with a tile coordinate. The complication is making this work for multiple tiles and then adjusting for an isometric grid, especially since it doesn't follow the 2:1 Ratio of a normal isometric grid. The isometric grid is based on a size of width 26 by height 14

EDIT 1#

OK REPHRASED

I need a mouse coordinate to isometric index system.

essentially a formula that can be used to convert the x and y mouse coordinates to a isometric tile.

As stated above the grid in this particular instance is a width of 26 and a height of 14, although the numbers can be simplified by just dividing those two out of the x and y coordinates. But then to transform these to an isometric remains the question.

ProgrammingGamer commented 6 years ago

OK I have found a temporary solution to this problem, as long as it works I may not change it.

` tilextype = (clicky/14) + (clickx / 26) tileytype = -((clickx / 26) - (clicky/14)) - 1

if (tileytype > 0):
    tileytype = tileytype + 1
    pass
if (tilextype < 0):
    tilextype = tilextype - 1
    pass`