Tile Maps
by Kneekick · in Torque Game Builder · 03/08/2006 (6:28 pm) · 4 replies
I'm a little frustrated with the tile maps.
First off I had trouble with the Platformer tutorial, I couldn't get the tilemap to load on layer(0), it would load on layer(1) but then I couldn't move it. So unable to find any solution to that I had to give up on the tutorial.
So I decided to start on my own game with fresh code files straight out of the beta zip file (just in case I had something screwed up somewhere) and now it's I'm in the same situation.
function createGrass()
{
%tileMap = new t2dTileMap()
{
scenegraph = t2dScene;
};
%tileMap.loadTileMap("~/data/tilemaps/fieldgrass.tile");
%layer = %tileMap.getTileLayer(0);
%layer.setPosition("0 0");
}
Does not show the tilemap. No errors are thrown in the console.
if I change it to this:
function createField()
{
%tileMap = new t2dTileMap()
{
scenegraph = t2dScene;
};
%tileMap.loadTileMap("~/data/tilemaps/fieldgrass.tile");
%layer = %tileMap.getTileLayer(1);
%layer.setPosition("0 0");
}
I can see the field but I throw errors in the console.
I'm using the base T2D files that come with the beta 1.1 under the T2D folder.
First off I had trouble with the Platformer tutorial, I couldn't get the tilemap to load on layer(0), it would load on layer(1) but then I couldn't move it. So unable to find any solution to that I had to give up on the tutorial.
So I decided to start on my own game with fresh code files straight out of the beta zip file (just in case I had something screwed up somewhere) and now it's I'm in the same situation.
function createGrass()
{
%tileMap = new t2dTileMap()
{
scenegraph = t2dScene;
};
%tileMap.loadTileMap("~/data/tilemaps/fieldgrass.tile");
%layer = %tileMap.getTileLayer(0);
%layer.setPosition("0 0");
}
Does not show the tilemap. No errors are thrown in the console.
if I change it to this:
function createField()
{
%tileMap = new t2dTileMap()
{
scenegraph = t2dScene;
};
%tileMap.loadTileMap("~/data/tilemaps/fieldgrass.tile");
%layer = %tileMap.getTileLayer(1);
%layer.setPosition("0 0");
}
I can see the field but I throw errors in the console.
I'm using the base T2D files that come with the beta 1.1 under the T2D folder.
About the author
#2
03/08/2006 (8:03 pm)
What are the console errors?
#3
03/09/2006 (4:30 am)
I figured it out finally. I copied some %layer. properties over from the sidescroller demo and it finally appeared on layer 0. Not sure which of the many made it appear but I will find out tonight, I'm going to remove them 1 by 1 until it doesn't work anymore.
#4
03/09/2006 (4:30 am)
Oh and thanks for the replies to help. :)
Torque Owner Glenn Prince