Problem with tilemap positioning
Posted: Mon Sep 16, 2013 5:19 pm
Hi,
I'm creating a tiled map and it's... well, misplaced. The obj[] entities are going to different coordinates, 50x and 75y bigger than they should. I tried translating to 0,0,0, translating to tile, changing origin, and nothing has worked so far. Here is my code, mostly copied from the examples, with a few changes only.
Help, anyone?
I'm creating a tiled map and it's... well, misplaced. The obj[] entities are going to different coordinates, 50x and 75y bigger than they should. I tried translating to 0,0,0, translating to tile, changing origin, and nothing has worked so far. Here is my code, mostly copied from the examples, with a few changes only.
Code: Select all
self.mainScene = new IgeScene2d()
.id('mainScene')
.translateTo(0, 0, 0)
.drawBounds(false)
.drawBoundsData(false);
self.backScene = new IgeScene2d()
.id('backScene')
.depth(0)
.drawBounds(false)
.drawBoundsData(false)
.isometric(true)
.mount(self.mainScene);
self.tileMap = new IgeTileMap2d()
.id('tileMap')
.isometricMounts(true)
.tileWidth(50)
.tileHeight(50)
.drawGrid(15)
.drawMouse(true)
.mount(self.backScene)
.depthSortMode(2)
.highlightOccupied(true);
for (var i = 0; i < self.mapData.length; i++)
{
var col = i%15;
var line = Math.floor(i/15);
self.obj[i] = new IgeEntity()
.id('tile'+i)
.texture(self.gameTexture.terrain)
.isometric(true)
.cell(self.mapData[i])
.dimensionsFromCell()
.mount(self.tileMap)
//.translateTo(col*50,line*50,0)
.translateToTile(col, line, 0);
//self.obj[i].originTo(self.obj[i].width()/2,self.obj[i].height()/2,0);
if (self.mapData[i] > 2)
{
self.obj[i].occupyTile(col,line,1,1,1);
}
}