GetTileLayerCount issue?
by Scott Johnson · in Torque Game Builder · 09/09/2006 (4:05 pm) · 0 replies
Howdy, I'm hitting the forums hard today... :)
Given that
$gameMap = $gameScene.getGlobalTileMap();
and $gameScene is an fresh scenegraph.
before I load my .t2d file, I check:
$gameMap.getTileLayerCount() = 0 // which it is.
I "load" my layer like so:
$gameScene.addToLevel(%level); // %level is the path to the .t2d level file
//this is my level0.t2d file
%levelContent = new t2dTileLayer() {
LayerFile = "tgboids/data/tilemaps/level0.lyr";
canSaveDynamicFields = "1";
size = "10240.000 10240.000";
Layer = "30";
WorldLimitMode = "BOUNCE";
WorldLimitMin = "-4999.000 -4999.000";
WorldLimitMax = "4999.000 4999.000";
CollisionActiveReceive = "1";
CollisionCircleScale = "2";
CollisionDetectionMode = "FULL";
CollisionResponseMode = "BOUNCE";
Immovable = "1";
MaxLinearVelocity = "0";
MaxAngularVelocity = "0";
mountID = "2";
type = "background";
};
Now when I do:
$gameMap.getTileLayerCount() = 2 // what? hows this possible?
It now returns 2, and when I observe the tile layer data, it shows that level0.lyr is loaded on each level.
(Note: I've also tried just using .loadlevel(%level), with the same result).
So.. its like it's loading it twice..
any one else observe this or does addTo or load Level have any known issues if a layer isn't already loaded?
Thanks for any info.
Edited for post improvement.
Given that
$gameMap = $gameScene.getGlobalTileMap();
and $gameScene is an fresh scenegraph.
before I load my .t2d file, I check:
$gameMap.getTileLayerCount() = 0 // which it is.
I "load" my layer like so:
$gameScene.addToLevel(%level); // %level is the path to the .t2d level file
//this is my level0.t2d file
%levelContent = new t2dTileLayer() {
LayerFile = "tgboids/data/tilemaps/level0.lyr";
canSaveDynamicFields = "1";
size = "10240.000 10240.000";
Layer = "30";
WorldLimitMode = "BOUNCE";
WorldLimitMin = "-4999.000 -4999.000";
WorldLimitMax = "4999.000 4999.000";
CollisionActiveReceive = "1";
CollisionCircleScale = "2";
CollisionDetectionMode = "FULL";
CollisionResponseMode = "BOUNCE";
Immovable = "1";
MaxLinearVelocity = "0";
MaxAngularVelocity = "0";
mountID = "2";
type = "background";
};
Now when I do:
$gameMap.getTileLayerCount() = 2 // what? hows this possible?
It now returns 2, and when I observe the tile layer data, it shows that level0.lyr is loaded on each level.
(Note: I've also tried just using .loadlevel(%level), with the same result).
So.. its like it's loading it twice..
any one else observe this or does addTo or load Level have any known issues if a layer isn't already loaded?
Thanks for any info.
Edited for post improvement.
About the author