Help with viewports

BlitzMax Forums/BlitzMax Beginners Area/Help with viewports

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Say that your game world is stored in an a 2d-array, telling you what each tile contains. So if you have variables for the player's X and Y coordinate, and you want the view area to extend 5 tiles away from the player, then make a nested for-loop (one of the X, one for the Y) that goes from the player's position minus 5 to the player's position plus 5, being careful to check that you're not going outside the bounds of the array. Then simply draw those tiles onto the screen.