Archived

This topic is now archived and is closed to further replies.

tenchimusakiryoko

Tile Map Scrolling

Recommended Posts

hey everyone, two questions.One, is the directx 9 sdk out?and the main question is this. I am making a tile engine(for an RPG)i have the tile map load from a char structure, and it draws the maps etc(Im using DX 8 btw) anyways, everything is set up, i just need a way to add scrolling. Is scrolling just modifying the x,y coordinates of the tiles?Like if they press left, every tile''s x coordiantes is subtracted by 32?(Tile size)thx

Share this post


Link to post
Share on other sites
it depends on how you want to do it. There is a very simple smooth scroller on my site you can look at. Nevermind that it is using my own API you should get the general idea by looking at the source.

regards

MichaelT

____________________________________________________________
Try RealityRift at www.planetrift.com

[edited by - MichaelT on January 18, 2003 5:01:28 AM]

Share this post


Link to post
Share on other sites
You must calcuate the screen coordinates for every object, like this :
object.screen_x = object.global_x - (player.global_x - player.screen_x)

In this case this holds true : if( key_left() ) player.x--;

For example:


    
player.global_x= 50
player.screen_x= 5

//player.screen_x is a default value, the amount of space before the player :


//-----P--O--


//0123456789A

//0-4 => p.s_x=5


object.global_x= 53
object.screen_x= 53 - (50 - 5) = 8


[edited by - viajero on January 18, 2003 5:37:34 AM]

Share this post


Link to post
Share on other sites