Coder's Guild Mailing List

Writing a Game - Scrolling

Posted by Matthias Carlsson on 1999-04-07

I'm quite new to game programming, and although I haven't really
seen any game related questions here, I figured it was worth a try.
I'm not interested in code, a nice explaination would be much better
since I want to do all the coding myself :P

Anyhow, imagine you had a scrolling game, where you control a character
in the middle of the screen. You can run in any direction (360º) with
smooth scrolling (not just when you hit the edge á la Zelda). What I'm
trying to figure out how I should keep track of everything outside the
visible scene, and how I should know when the objects are in range and
should be painted and everything. Someone once told me that I should
keep track of all objects' x & y values (it's a 2D game), which sounds
reasonable, and then paint them when they're inside the visible field. 
But, how? :D E.g. should I put all objects in a big array which I in a
while(true) loop loops over and over again checking the x & y values?

I hope I don't sound to confusing and that anyone hopefully can help
me out on this one. The game is going to be written in Java BTW.

// Matt