Jump to content
• Advertisement

Im having problems on figuring how to...

This topic is 5189 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

Share on other sites
Advertisement
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

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

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

Moved.

Share this 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

Share on other sites

• Advertisement
• Advertisement

• Popular Contributors

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 10
• 28
• 20
• 9
• 20
• Forum Statistics

• Total Topics
633410
• Total Posts
3011727
• Who's Online (See full list)

There are no registered users currently online

×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!