2D Scrolling

BlitzMax Forums/BlitzMax Beginners Area/2D Scrolling

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'd make a 2d array of ints/shorts/bytes if your mapdata only has a simple structure and a custom tiletype if your mapdata is a little bit more complex (gfx numbers, event triggers, discovery fog etc.).

Then it's all a matter of displaying parts of the map in the right part of the screen. Just work with pixel-based coordinates. If your tiles are like 16x16 and your pixelcoordinate/mapoffset is like 66,40 then the tile offset would be 4,2 (int 66/16, int 40/16) and the pixel/scroll offset would be 2,8 (66 mod 16, 40 mod 16). So, you'll know what tiles to draw and at which offset.. piece o' cake!