Game Development Community

Tilemaps / TileLayers Hosed in 1.5.1?

by James Ford · in Torque Game Builder · 09/03/2007 (8:13 pm) · 2 replies

I'm not sure of a better way to do this, so, heres a list of everything having to do with tiles that seems broken.

1. You cannot create a tilemap object in the editor, only tilelayers
2. Creating a tilemap in script and adding tilelayers to it with either addlayer or createlayer fails.
3. Tilemapdatablocks are referenced in documentation but don't seem to exist.

This leaves no way to get a tilemap that actually contains tilelayers, leading me to believe tilemaps are in the process of being totally removed?

4. Cloning a tilelayer fails (tilesize, tilecount, and the properties of individual tiles are not copied)

I found out how to create a tilelayer of a specific dimension in script like:
%lyr = new t2dtilelayer();
%lyr.createlayer(4,4,5,5);

5. Trying to set the tiles of a dynamically created tilelayer crashes TGB

After the previous code I tried:
%lyr.setStaticTile("2 2",BlocksImageMap,1);
%lyr.setAnimatedTile("2 2",BlocksAnimation,1);

The setTile methods work if you are modifying a tilelayer that was created in the editor, but not if it is a tilelayer created in the way I have. Is there just another step to creating a tilelayer in script that must be done before starting to set tiles, or is it just not possible? The ability to dynamically create tilelayers in script is a definite necessity.

#1
09/04/2007 (1:31 pm)
Yeah, the tilemap object is just a holder for tilelayers, and it seems like GG decided it was sort of superfluous, but didn't want to take the time to remove it completely. So their solution was to have one tilemap that just sits in every scene (see the level editor treeview).

Tilelayers are really the only object you're meant to work with, and all the important functions exist within them. At least as I understand it. Is there something you specifically need to do with the tilemap object?
#2
09/04/2007 (2:14 pm)
What I need is the ability to create new tilelayers from the script side. Perhaps I need to name the tilemap in my level and I can add layers to it without crashing? Or I need to create a new tilelayer, specify the filename field (to some generic tilelayer file) and then I can change it without crashing. These are two new ideas I will have to try out.