Game Development Community

Tiles problems

by Bruno · in Torque Game Builder · 09/18/2005 (8:21 am) · 2 replies

Hello,

I'm tryng to make a test map, with several tile layers, but somehow i can't get this working or looking as it is in the tile editor.
Currently i have 2 layers, one that represents Space, and one on top of it that represents some kind of metallic structure.
The fist layer is setup like this :

// Load tile layer from tile-map
%spaceLayer = %scrollerMap.getTileLayer( 0 );

%spaceLayer.setPosition( "0 -5" );
%spaceLayer.setTileSize( "25 25" );
%spaceLayer.setWrap( true, false );
%spaceLayer.setAutoPan( "10 0" );

So, i have a nice looking space, with the tiles scaled at size 25, scrolling around

My second layer is setup like this :


// Load tile layer from tile-map
%bLayer1 = %scrollerMap.getTileLayer( 1 );

%bLayer1.setPosition( "-35 0" );
%bLayer1.setTileSize( "1 1" );
%bLayer1.setWrap( true, false );
%bLayer1.setAutoPan( "10 0" );

The position where i set it up is the same where the player is showing up, the tile size is to match exactly how it is in the tile editor.
I see nothing at all of the second layer ingame, however if i comment setPosition and setTileSize, i do see the layer but begining in a wrong place.

Both layers have sizes of 1000x50.

Any clues on what i could be doing wrong ?
thanks,

Bruno

#1
09/18/2005 (8:46 am)
Comment setPosition and setTileSize from both layers and try adding this:

%spaceLayer.setLayer(1);
%bLayer1.setLayer(0);

I had same kind of problem when I first tried to use two layers in tile editor and the layers had to be in opposite order.
#2
09/19/2005 (8:24 am)
Thanks Olli, that fixed it ;)