Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrolling, Please Help

Status
Not open for further replies.

ChilliD

Programmer
Jun 10, 2004
5
0
0
US
How do you scroll from map to map? Like, If you have two or more sets of data how do you move from one to the other? You know, like in games, when you walk off screen and you end up in another 'map'. By sets of data I mean bitmaps

data 1, 1, 1
data 1, 1, 1, 1 etc...

Please help!!!
 
Figure out where your player is on the screen

DIM SHARED bitmaps$(10,10), curbitx%, curbity%
DIM SHARED playersx%, playersy%
IF playersx% > 320 THEN
curbitx% = curbitx% + 1
loadbitmap
ELSEIF playersx% < 0 THEN
curbitx% = curbitx% - 1
loadbitmap
ELSEIF playersy% > 200 THEN
curbity% = curbity% + 1
loadbitmap
ELSEIF playersy% < 0 THEN
curbity% = curbity% - 1
loadbitmap
END

SUB Loadbitmap
OPEN bitmap$(curbitx%, curbity%) FOR BINARY AS #1
...
END SUB

I assume since you said you are using bitmaps that you already have one, if you do need one, just post again and I will post it for you.
 
Figure out where your player is on the screen

DIM SHARED bitmaps$(10,10), curbitx%, curbity%
DIM SHARED playersx%, playersy%
IF playersx% > 319 THEN
curbitx% = curbitx% + 1
playersx% = 0
loadbitmap
ELSEIF playersx% < 0 THEN
curbitx% = curbitx% - 1
playersx% = 319
loadbitmap
ELSEIF playersy% > 199 THEN
curbity% = curbity% + 1
playersy% = 0
loadbitmap
ELSEIF playersy% < 0 THEN
curbity% = curbity% - 1
playersy% = 199
loadbitmap
END

SUB Loadbitmap
OPEN bitmap$(curbitx%, curbity%) FOR BINARY AS #1
...
END SUB

I assume since you said you are using bitmaps that you already have one, if you do need one, just post again and I will post it for you.
 
Thanks alot! But I'm not sure exactly what you mean...
I kind of get it but I'm not sure where in my source to put it or what exactly it does. Thanks again, I'll try it

Chilli-D
 
I think I have a bitmap, that's

data 1, 1, 1,
data 1, 1, 1, 1, 1, 1 etc, right?
and does the source code you gave me scroll between two sets of data? Thanks again!

Chilli-D
 
No, well... techinically that is a bitmap, I was under the impression that you were using a bitmap file. A drawing that you made in Paint.

Using DATA sets will be much harder to use and take up more memory, I recommend drawing your landscape in Paint and useing a bitmap file loader to draw them on the screen.

The code I posted would go after you moved your character. ie. after the keyboard routine but before you actually draw him.

Basically what the code does is it figures out if the player is off the screen and which edge he went off of. Then it moves to the next map accordingly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top