Game Development Community

How do you "keymap" the tilemap

by Steve Bisson · in Torque Game Builder · 04/25/2006 (3:31 am) · 2 replies

I want to put a tiny ship in the middle of the screen and have the tilemap move underneath it to simulate moving around on a terrain.


i tried this :D.. but not use

function playerDown()
{
// Set the player moving down.
%skyLayer.setscroll( "-30 0" );
}


on another note.. is it possible to use many "objects" in the same function ?

like so

function playerUp()
{
// Set the player moving down.
$player.setrotation( -90 ) ;
%skyLayer.setscroll( "-30 0" );

}

?

BTW TGB is great ! :D

#1
04/25/2006 (3:47 am)
See this thread for getting tile layers moving: www.garagegames.com/mg/forums/result.thread.php?qt=43335

As to multiple objects within a function, yes it's possible, BUT....

When you create your tile layer, I guess you're using:
%skyLayer = new blahblah

That's all fine, but once you've setup the layers, you don't have access to them anymore, as the %skyLayer variable ceases to exist.

The easiest fix is to use:
$skyLayer = new blahlah

Then you can set your function as follows:
function playerUp()
{
// Set the player moving down.
$player.setrotation( -90 ) ;
$skyLayer.setAutoPanPolar( $player.getRotation, 30 );
}
#2
04/25/2006 (11:32 am)
Using $ instead of % made it work !... thanks , i now understand the difference between the two of them :)