2D Scrolling
BlitzMax Forums/BlitzMax Beginners Area/2D Scrolling
| ||
Hi all, Just wondering how people go about doing a 2D scrolling game. I am doing a game when the level will be populated using a tile map and I want to be able to scroll the map in 8 directions at any speed with accurate collisions. Would I be better storing my tile info in an array or in a type, to allow more flexability. I am using BlitzMax. Any links to tutorials or tips welcome. Cheers DIJ |
| ||
Take a look at this : http://www.scottshaver2000.com/forum/viewtopic.php?t=94 |
| ||
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! |
| ||
There is also my tilemap example available from the code section of my Blitz site below (the right one of those two logos). Just scroll down a bit and you'll find one for BlitzMax. |
| ||
Take a look at this : www.scottshaver2000.com/forum/viewtopic.php?t=94 The link doesn't work. Thanks for the help and links, I should be able to figure it out from there. @JazzieB, I'll have a look at the example. Ta |
| ||
I would probably use an array of types |