Where may i found some RPG examples scrolling?
by Matthews_30 · in Torque Game Builder · 10/11/2005 (12:46 pm) · 1 replies
I want to try to create a tile scrolling 2D map. The map must move to up, down, left and right accordingly to the chacracters movement (diablo 2 like).
any samples?
thanks,
matt.
any samples?
thanks,
matt.
Torque Owner C. N.
Moving tilemaps around isn't hard at all with T2D (actually, it's ridiculously intuitive). Tilemaps are just handled like sprites and therefore can be moved around like sprites, but it's better to pan around tilemaps with a mounted camera. T2D does all this for you with some basic setup and out-of-the-box function calls. Something like:
// $player is an fxAnimatedSprite2D, but you can mount the
// camera to anything as long as it's part of the scenegraph
sceneWindow2D.mount($player);
will mount the camera to the object you feed it, keeping that object in it's center. Then (assuming you have your keyboard input setup) when you do something like:
// somewhere else an 'onKeyDown()' has been activated
$player.setVelocityX(10);
the camera will just follow the player, so you don't need to move the map.