Game Development Community

Bug? tilelayer::setTileCustomData cleared during setStaticTile

by Jason Cahill · in Torque Game Builder · 03/27/2005 (11:00 am) · 2 replies

Perhaps this is "by design", and it was easy to work around, but it should definitely be marked in the docs. It's definitely not what I expected.

Repro:
//Already created a TileMap (e.g., a 3x3 tile map) with a single TileLayer
%tl = $tileMap.getTileLayer(0);
%x = 0;
%y = 0;

%tl.setTileCustomData((%x) SPC (%y), "foobar");
%tl.setStaticTile((%x) SPC (%y), imdbArt, %newtileImage);
%customData = %tl.getTileCustomData((%x) SPC (%y));

Result:
%customData == ""

Expect:
%customData == "foobar". I expect the data to live in that tile
and not be related to the tile image I chose.

Workaround:
//whenever you are using tile custom data, set your tile images as follows:
%customData = %tl.getTileCustomData((%x) SPC (%y));
%tl.setStaticTile((%x) SPC (%y), imdbArt, %newtileImage);
%tl.setTileCustomData((%x) SPC (%y), %customData);

#1
03/27/2005 (2:32 pm)
Jason,

I'll check that out. You are correct; the custom-data should be associated with the tile, not the reusable tile container.

Be aware that custom-data is not currently being saved and is a bug to be fixed.

Thanks for the heads-up. :)

- Melv.
#2
03/27/2005 (11:19 pm)
Re: saving, that's no problem. For my game, I'm going to build my tile maps via script, rather than loading them from saved entities in the tile editor. Given the EULA constaints, I'm interested in building my own "level editor" that is specifically geared toward making maps for my game... rather than being a general purpose game development tool.