Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Tile Based Maps and Scrolling

Author
Message
Sad Professor
21
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 30th Jun 2005 23:50
Hi, I'm developing tile based code which will draw a map from a 2D array of tiles. I understand the theory of it all but have a question regarding scrolling. I understand how to move the tiles when the focus of your map moves (usually the player) but how do you go about scrolling pixel by pixel as opposed to scrolling by tile - essentailly how do you read the value of the tile in and render only a portion of that tile?

I expect there is a really obvious answer to this question, but thought it'd be quick to answer
thanks
Richard Davey
Retired Moderator
24
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 1st Jul 2005 00:04
Render the current location to an off-screen bitmap (that is slightly larger than the current screen resolution) and then render that to the screen instead, when you cannot scroll any further you re-draw the off-screen bitmap with the new set of tiles, and repeat the process.

A great many people think they are thinking when they are really rearranging their prejudices.
Sad Professor
21
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 1st Jul 2005 00:09
Fantastic! Thanks a lot for the help!
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 2nd Jul 2005 05:24 Edited at: 2nd Jul 2005 05:25
Also have a look at this

http://www.thegamecreators.com/?m=codebase_view&i=0ee878a92195ee8c39c59bc3196e47d1

It shows you how to do what you want to do without any offscreen bitmaps.

Caldar
20
Years of Service
User Offline
Joined: 13th Aug 2005
Location:
Posted: 13th Aug 2005 21:51
Pizzaman, your tile engine is great but... how would you modify it for different resolutions?

I've tried simply changing the amount of tiles, the screen size, etc... but I still end up with errors.

I wish I could find a much simpler version that would be easier to understand.. barebones kinda example.

All the examples/tutorials on the net are in c++ which is completely beyond me.

Login to post a reply

Server time is: 2026-06-12 13:03:14
Your offset time is: 2026-06-12 13:03:14