I'll try to explain out how I'm handling my map and see if that helps.
I have a map holder object, oMapHolder, that contains a ds_grid ("map") of single integer numbers that is taken in by oMapHolder's step function.
I then have another grid that holds the placed tile's index at the corresponding grid location.
if (map[# 0,0] != noone && beenInitiated == false)
{
tileIDGrid = ds_grid_create(gridWidth, gridHeight);
for (yCordInGrid = 0; yCordInGrid < gridHeight; yCordInGrid++)
{
for (xCordInGrid = 0; xCordInGrid < gridWidth; xCordInGrid++)
{
ds_grid_set(tileIDGrid, xCordInGrid, yCordInGrid, placeTile(xCordInGrid,yCordInGrid,map[# xCordInGrid,yCordInGrid]));
}
}
beenInitiated = true;
}
This gives me the ability to call on a specific tile that I can visibly see, and edit it accordingly, i.e. if I need to change something at 3,3, I can just use that index in tileIDGrid to directly access that tile.
The problem is arising from when I am trying to zoom (panning works fine).
Here is the zoom function (obviously for zoom out, but all zoom in does is change the scale to += .1)
case zoomOut:
{
with (oMapHolder)
{
tileScale -= .1;
for (var yIndex = 0; yIndex < gridWidth; yIndex++;)
{
for (var xIndex = 0; xIndex < gridWidth; xIndex++;)
{
var tile = tileIDGrid[# xIndex,yIndex];
//the 5's here are totally arbitrary. I also tried multiplying them by the scale btu produces the same result)
if(xIndex>0 && xIndex>=yIndex){tile_set_position(tile, tile_get_x(tile) - 5, tile_get_y(tile) - 5);} //adjust right of origin tiles for zoom
if(yIndex>0 && yIndex>=xIndex){tile_set_position(tile, tile_get_x(tile) + 5, tile_get_y(tile) - 5);} //adjust left of origin tiles for zoom
if(yIndex == xIndex){tile_set_position(tile, tile_get_x(tile), tile_get_y(tile) - 5);} //adjust left of origin tiles for zoom
}
}
for (var yIndex = 0; yIndex < gridWidth; yIndex++;)
{
for (var xIndex = 0; xIndex < gridWidth; xIndex++;)
{
var tile = tileIDGrid[# xIndex,yIndex];
tile_set_scale(tile, tileScale, tileScale);
}
}
}
}
What I was trying to do was going off the assumption that I needed to change the location of the tiles after they had all been scaled, but what I am getting instead is this:
![](https://31.media.tumblr.com/b5479901358e9e99a57ef4485bf30d15/tumblr_n1q72xV1LV1ttbf76o1_500.gif)
I totally recognize that I also may be approaching this the total wrong way, so if anyone wants to show me the error of my ways I'd be greatly appreciative.
Hope this helps!
PS, the grid coordinates by the cursor are reacting to a collision grid mapped to the tiles. Fixing this is a whole different issue, as now I'm just trying to focus on what is actually seen.