Game Development Community

Diferent Layer Sizes

by Bruno · in Torque Game Builder · 10/05/2005 (9:47 am) · 9 replies

Hello,

I made a tile map, in which there are 4 diferent layers, with diferent layer sizes, and diferent tile sizes.
The map loads fine in the tile editor, and shows up ok.
However, when i load it in the game itself, i don't see anything, and the console log reports me this :

fxTileMap2D::loadTileMap() - Cannot Load without SceneGraph!
fxTileMap2D::getTileLayer() - Invalid Tile Layer '0'! Currently '0' Layers available.
T2D/client/client.cs (88): Unable to find object: '-1' attempting to call function 'setPosition'
T2D/client/client.cs (88): Unable to find object: '-1' attempting to call function 'setTileSize'
T2D/client/client.cs (88): Unable to find object: '-1' attempting to call function 'setWrap'
T2D/client/client.cs (88): Unable to find object: '-1' attempting to call function 'setAutoPan'
T2D/client/client.cs (88): Unable to find object: '-1' attempting to call function 'setLayer'



That map has 4 layers, and he can't even find the first layer.
Thanks,

Bruno

#1
10/05/2005 (9:48 am)
Could we see your code?

edit:
Actually, nevermind. Note the first line that you've pasted from the console.log:
Quote:fxTileMap2D::loadTileMap() - Cannot Load without SceneGraph!
#2
10/05/2005 (9:52 am)
Sure.,
I'm only tryng to load 2 layers there, even if i comment the second layer, the console log will report the same.


function CreateTileMap()
{

// Create tile-map.
%scrollerMap = new fxTileMap2D() { scenegraph = t2dSceneGraph; };

// Load saved tile-map file.
%scrollerMap.loadTileMap("~/client/maps/scroller.map");

// Load tile layer from tile-map
%skyLayer = %scrollerMap.getTileLayer( 0 );
%skyLayer.setPosition( "1675 219" );
%skyLayer.setTileSize( "75 75" );
%skyLayer.setWrap( true, false );
%skyLayer.setAutoPan( "10 0" );
%skyLayer.setLayer(6);





// Load tile layer from tile-map
%bLayer1 = %scrollerMap.getTileLayer( 1 );
%bLayer1.setPosition( "1675 219" );
%bLayer1.setTileSize( "75 75" );
%bLayer1.setWrap( true, false );
%bLayer1.setAutoPan( "20 0" );
%bLayer1.setGroup(2);
%bLayer1.setLayer(2);
%bLayer1.setCollisionMasks(BIT(2),BIT(2));
%bLayer1.setCollisionActive( false, true ); // SEND, RECIEVE
%bLayer1.setCollisionMaterial( standardMaterial );
%bLayer1.setCollisionCallback( true );

}
#3
10/05/2005 (9:53 am)
Yes, i saw that line, what does it mean, that it cannot create the SceneGraph ?
#4
10/05/2005 (10:07 am)
What it looks like to me is that you've specified a non-existent scenegraph when creating your tilemap (scenegraph = t2dSceneGraph).
#5
10/05/2005 (10:10 am)
Well, in this line ?

%scrollerMap = new fxTileMap2D() { scenegraph = t2dSceneGraph; };

Whats is wrong there ? I use this to load any map i make, and so far was working fine.


If you are talking about this one ?

%scrollerMap.loadTileMap("~/client/maps/scroller.map");

The map does exist..

It seems to me that the problem is in the map itself, because if i use a diferent map, it loads fine.
The only diference in this map, is that it has diferent map sizes\layers.., you know if this is a problem ?
#6
10/05/2005 (10:15 am)
Ah, I wasn't aware you had successfully loaded other maps into your project. I'm gonna go ahead and bow out, since that's about the extent of my limited knowledge with tilemaps. :p
#7
10/05/2005 (10:19 am)
Hehehe, bowing out so soon ? :P
but thanks m8 :)
#8
10/05/2005 (12:40 pm)
In the example folder you'll find the scenegraph created in T2D/client/client.cs, in setupT2DScene()

new fxSceneGraph2D(t2dSceneGraph);

If you've changed that, OR if you're calling createTileMap before setupT2DScene() gets called, the error you're seeing is because you've tried to create a fxSceneObject2D and attach it to a scenegraph that hasn't been created yet.

--
Hans
#9
10/05/2005 (3:09 pm)
No Hands, i wasn't doing that.
I think i found some kind of bug in Torque2D, is the only explanation i can find.
I kept the map as a backup, and made another one, with diferent layer sizes, diferent tile sizes, with the exact same information, and this one loads and plays fine.., dunno what's wrong with the other one, and i don't understand how can the tile editor read it, and the game doens't..., oh well, at least i got it working .

thanks anyways,
Bruno