New topic: Scrolling Tile Map
<http://forums.realsoftware.com/viewtopic.php?t=32175> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message MadDoc Post subject: Scrolling Tile MapPosted: Mon Jan 25, 2010 4:08 am Joined: Wed Oct 05, 2005 1:21 pm Posts: 220 Location: United Kingdom I'm sure this is in everybody's 'Game 101' but I'm struggling to make a simple scrolling tile map. I have a map of 200x200 tiles. Each tile is a 50x50 pixel square. The tiles are stored in an array - Tiles(column, row), where each element of the array is a special class, imaginatively called TileClass that has a single property - Image as picture. The window the map is being displayed in is 500x500 pixels. I have figured out how to scroll this map with the arrow keys if I draw the ENTIRE map to an offscreen buffer picture and simply scroll that around a viewing canvas. The problem with this is that it is so slow (probably because the memory footprint is big with 40,000 tiles!). I know that the best way to do this would be to draw only the tiles that can be seen (in my case, 10x10 tiles on screen at once). I am struggling to figure this out - particularly as I would like to be able to see the edges of the tiles that are just off the viewing canvas (so you can see what tiles are 'coming up' if you continue to scroll). Does this make sense? Does anyone have any sample code they would be willing to share? Thanks, _________________ Figa Software | My Flickr | My Blog MacBook Pro 2.53Ghz, 4GB RAM, OSX 10.6.1, RB 2009r3 Pro Mac Mini 2.53Ghz, 4GB RAM, OSX 10.6.1 | iPhone 16GB | Nikon D60 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
