[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4149: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3027)
Pete's QBASIC Site • Scrolling Camera
Page 1 of 1

Scrolling Camera

Posted: Tue Aug 10, 2004 2:01 pm
by Guest
I have been working on my first RPG.


What is a "camera" and what does it have to do with scrolling?

Posted: Tue Aug 10, 2004 4:00 pm
by Pete
The camera is the area of your map that you can see.

Say your map is 200 tiles wide by 100 tiles high, and your tiles are 20*20 pixels.

If you're using Screen 13, you'll only be able to see a grid of 16 tiles wide by 10 high. That's a whole lot smaller than the total size of your map. At any particular time, you can show any 16*10 area of your map on the screen....

.....but there's usually only one area that you're really interested in. Somewhere on that map is your hero character that the player is moving around. In order to have a good game, you always want your character to be on the screen. Otherwise it would be pretty tough to play the game. So in your program, you write a routine that makes sure that your character is always somewhere on the screen. The camera scrolls to always keep the on screen.

Occasionally, though, you don't want your character right in the middle, such as when he gets near the edge of the map. Since beyond the edge of the 200x100 of your map, there is nothing. It will probably show up as empty black tiles -- which is pretty ugly compared to your actual map.

So when you get to an edge or a corner, you want the camera to stay ON THE MAP. Your character can keep on moving, but the map will stop scrolling until he's heading back toward the center (where you don't have edges and corners).

It's not really that hard of a concept...you probably already understood it, but didn't know that the term was "camera". :)

Posted: Tue Aug 10, 2004 10:01 pm
by Rel.
Yep, Camera is your viewport

http://rel.betterwebber.com/junk.php?id=16