to scroll or not to scroll

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
jumboorange
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 3
Joined: Tue Jan 20, 2009 9:58 pm

to scroll or not to scroll

Post by jumboorange »

So about 9 days ago I was bored in class and decided to rewrite a RPG I made in September in visual basic. So I went on the look for a new programming language to use (not windows only) and I decided on glbasic http://www.glbasic.com/main.php?lang=en
because it runs on the gp2x http://en.wikipedia.org/wiki/GP2X. It has begun to take form but there's been one thing on my mind since my first RPG attempt(which was three years ago on the TI-83+ calculator), and that is how to do scrolling maps.
I've done fixed screen maps several times but have never made a scrolling system(that works).
Do you guys think I should invest time in making such a system? Or should I stick with what I know and continue on other parts of the game. I'm not sure scrolling maps will be useful on such a small screen (320 x 240, 3.5 inch)

I don't have much to show off from the game so I put together a quick website (really quick):
http://freedomdown.atspace.com/
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: to scroll or not to scroll

Post by LeonBlade »

jumboorange wrote:So about 9 days ago I was bored in class and decided to rewrite a RPG I made in September in visual basic. So I went on the look for a new programming language to use (not windows only) and I decided on glbasic http://www.glbasic.com/main.php?lang=en
because it runs on the gp2x http://en.wikipedia.org/wiki/GP2X. It has begun to take form but there's been one thing on my mind since my first RPG attempt(which was three years ago on the TI-83+ calculator), and that is how to do scrolling maps.
I've done fixed screen maps several times but have never made a scrolling system(that works).
Do you guys think I should invest time in making such a system? Or should I stick with what I know and continue on other parts of the game. I'm not sure scrolling maps will be useful on such a small screen (320 x 240, 3.5 inch)

I don't have much to show off from the game so I put together a quick website (really quick):
http://freedomdown.atspace.com/
I think you should definitely not limit your maps to be so small.
If you want a scrolling map, here is some pseudo code you can do...

Code: Select all

if player.X >= screenWidth / 2 or player.X <= mapWidth - screenWidth / 2 
{ 
    // scroll left and right
}
if player.Y >= screenHeight / 2 or player.Y <= mapHeight - screenHeight / 2
{
    // scroll up and down
}
Something along those lines...
The scrolling would basically having the camera center on your player.
There's no place like ~/
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: to scroll or not to scroll

Post by eatcomics »

Why would having a small screen mean having small maps better than large scrolling maps??? That just means you should do scrolling to have more to work with!
Image
jumboorange
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 3
Joined: Tue Jan 20, 2009 9:58 pm

Re: to scroll or not to scroll

Post by jumboorange »

I got it working, and it does look a lot better on the small screen.
Now I need to work on events cause I can't use the edge of the screen to teleport the player...
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: to scroll or not to scroll

Post by LeonBlade »

jumboorange wrote:I got it working, and it does look a lot better on the small screen.
Now I need to work on events cause I can't use the edge of the screen to teleport the player...
You could... if your player touches the edge within certain constraints...

Like, if player.X >= 60 && player.X <= 40
Something like that... you get the idea...
There's no place like ~/
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: to scroll or not to scroll

Post by MarauderIIC »

Yes, use the end of the map rather than the end of the screen.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply