Sign in to follow this  

Im having problems on figuring how to...

This topic is 4846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im having problems on figuring how to make a scroll based system... i want to make a game wich is 2d and the camera is right over you all the time so the player is always in the center but the map scrolls after him... my question is how to make that... just some theory about it and loading map tiles... tutorials would be apriceated (im sure i spelled that awfully wrong) greetings, Max

Share this post


Link to post
Share on other sites
Theres some good tilebased stuff in the articles section. A little old perhaps but still relevant.

Anyway, the trick to scrolling is working in several different coordinate systems. First you need your 'world' coord system, which describes where individual objects (like tiles, sprites, the player etc.) all are. Then you've got a 'screen' coord system - if you've done any 2d drawing before thats what you've worked in. Typically you have the origin at the top left of your actual display.

The 'trick' to scrolling is to have some kind of camera - just one that holds a single position is good enough. Then when drawing you've got to convert your world coords for each object into screen coords by subtracting the camera's position. Then you're free to store everything in your game in world coords and simply change the camera position to view different parts of it (and so you can easily set the camera to follow something like your player).

Share this post


Link to post
Share on other sites
hmmm... there seem to be alot of requests for tilemap tutorials. Perhaps I should write one....

Have you looked at the articles section?

Basicly, what you want is a 2d array ( a matrix) of integers, and for each value, you assign a tile.
say tile 0 is dirt, tile 1 is grass, tile 2 is pavment, and tile 3 is a brick wall.

i'm definitely going to write a tutorial on this subject now. It's kind of hard to explain with out a specific question though.

but essentially, what you want is a matrix of values, and for each of those different values, you draw a diferent object.

feel free to ask more specific questions.

Share this post


Link to post
Share on other sites
thanx for the fast reply..

okay i dont think i get it to 100% but i think i know the idea of it ill read the articles... if i have any questions after that ill come back

Share this post


Link to post
Share on other sites
If you want you can download my 'ole tile scroller (source included). It might be useful. You can get it at http://kurioes.dyndns.org/

EDIT: the download links should now work :)

[Edited by - Kurioes on September 6, 2004 11:41:25 AM]

Share this post


Link to post
Share on other sites

This topic is 4846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this