Game Development Community

Tile Layer Loading Problems

by Greg Cutcher · in Torque Game Builder · 07/29/2005 (3:16 am) · 1 replies

Hey folks.

When I create a tile map with two layers, I cannot seem to get my code to read it. Actually, when I load up my code, it says a Datablock is invalid, but when I have only the single layer tile map, there is no problem. Also, T2D doesn't seem to be able to read the dual layered map.

Now, the first tile layer is normal while the second layer has colisions, so could that be my problem? Here are snipits of my code:

// Create images for the tilemap
datablock fxImageMapDatablock2D(levelMap)
{
mode = full;
textureName = "~/client/images/Fake_bg.jpg";
};

// Create images for the tilemap
datablock fxImageMapDatablock2D(Fake_bg_ground)
{
mode = full;
textureName = "~/client/images/Fake_bg_ground.png";
};



// Creates a tile-map
function CreateTileMap()
{
// load tile map
%levelMap = new fxTileMap2D() { scenegraph = t2dSceneGraph; };

// load saved tile-map file
%levelMap.loadTileMap("~/client/maps/Fake_bg.map");

// load tile layer from tile-map
%LevelLayer = %levelMap.getTileLayer(0);

// Sets position of LevelLayer
%LevelLayer.setPosition("0, 0");

%LevelLayer.setTileSize( "100, 75" );
%LevelLayer.setWrap( true, false );
}


Am I just being ignorant on something? :) Help please!

#1
07/29/2005 (3:43 am)
So when you used the tile-editor, you used a datablock called "levelMap" to draw it? T2D will tell you the datablock it couldn't find when loading the tile-map if there's a problem.

Do you know that "setTileSize()" sets the size of each individual tile?

Can't real add to this without more info unfortunately.

- Melv.