#3998 - Eep - Sat Mar 15, 2003 7:55 am
I'm having trouble setting a map starting position. I've created a map that is 512x256 and the map loads the tiles and everything fine, but the starting position of the view is in the upper left hand corner. The ground of my map is in the lower left hand corner and I'm having trouble getting it to boot in the lower part of the map. I'm out of ideas to correct this. Any ideas would be helpful.
Also, when I play my demo on the hardware and scroll past the first part of the map, the tiles don't display correctly and different tiles show up in pieces. It works fine on the emu (VisualBoyAdvance v1.3), of course.
Any advise would be greatly appreicated.
Thanks
#4000 - XeroxBoy - Sat Mar 15, 2003 10:02 am
Regarding the map starting position, all you have to do is scroll the map using the scroll regs as soon as you load it.
#4001 - DekuTree64 - Sat Mar 15, 2003 4:59 pm
Do you mean just setting the scroll regs messes things up, or are you using a scrolling engine that loads in new tiles off the edge of the screen as you walk around? That's what I do, and I just have it load in 32 strips of tiles from top to bottom or left to right, and it works fine. I'd have to see your code to find the problem. Also, why are you using 512x256? 256x256 is big enough to fill the screen. I guess you can only scroll 1 tile at a time before you can see things popping up though
#4002 - Eep - Sat Mar 15, 2003 5:20 pm
Cool! That did it of course. I should have though of that before. Thanks a million!
I'm still having the same trouble on the hardware though. I wish I could get a screen shot though.
Thanks for the help with the starting point.
Any other ideas on the weird hardware problem would be greatly appeicated.
Thanks.
#4003 - Eep - Sat Mar 15, 2003 5:29 pm
Sorry DekuTree64, I missed your post. Here's the code I'm using for the scrolling. It's fairly simple and works great on the emu. When I test it on the gba and try scrolling past the first screen of the map that the gba displays, the tiles get all chopped up. I'm not loading any other tiles as I walk. This is all that is in my game loop for right now.
Code: |
if(KEY_LEFT)
x--;
if(KEY_RIGHT)
x++;
if(KEY_DOWN)
y++;
if(KEY_UP)
y--;
while(x > (512 - 240))
x--;
while(x < 0)
x++;
while(y > (256 - 160))
y--;
while(y < 0)
y++;
REG_BG0VOFS = y;
REG_BG0HOFS = x;
waitForVsync();
|
Thanks for the help!
#4004 - Lord Graga - Sat Mar 15, 2003 5:54 pm
Code: |
if(KEY_LEFT)
x--;
if(KEY_RIGHT)
x++;
if(KEY_DOWN)
y++;
if(KEY_UP)
y--;
if (x> 512 - 240))
x= 512-240;
if (x<0)
x=0;
if(y > (256 - 160))
y=256-160;
if(y < 0)
y=0;
REG_BG0VOFS = y;
REG_BG0HOFS = x;
waitForVsync(); |
It doesn't change anything at all, but it is better.
#4005 - Eep - Sat Mar 15, 2003 6:26 pm
Thanks, Lord Graga!
Hey thanks for releasing your platforming source code. It's really helped me fix me collision detection routine. I'll send you a copy of my demo (when I get it done), if you'd like. So you can see the changes I've made.
Thanks for the optimization help again.
I tried recreating my map and recompiling, but that didn't help. Still having the same problem on the hardware.
#4006 - DekuTree64 - Sat Mar 15, 2003 6:29 pm
Hmm, that's strange. The scrolling code is fine though, so it must be in the loading somewhere. I don't know why it would work on the emu but not hardware though. Maybe you're trying to copy tyhings 1 byte at a time? VRAM can only be written to 16 or 32 bits at a time, which I don't think the emu cares about. And then what number are you using for your first screen block? If you're using 31, and then writing to BGS(31) + 1024 + x + y * 32 for your second screen, it could be writing past the end of available VRAM, which the emu may not pick up on. Or writing over your screen mem with tiles or something. Not much else I can think of right now (I'm just taking wild guesses here^^)
#4007 - Eep - Sat Mar 15, 2003 6:41 pm
You hit the nail on the head DekuTree64. Thanks.
I was selecting Screen Base Block 31. I forgot that I first started off using a 256x256 background, and I didn't change it when I changed the background.
Thanks a million. I should have seen it.
#4008 - Lord Graga - Sat Mar 15, 2003 7:37 pm
Code: |
if(KEY_LEFT)
if(x!=0)
x--;
if(KEY_RIGHT)
x++;
if(KEY_DOWN)
y++;
if(KEY_UP)
if(y!=0)
y--;
if (x> 512 - 240))
x= 512-240;
if (y> (256 - 160))
y=256-160;
REG_BG0VOFS = y;
REG_BG0HOFS = x;
waitForVsync(); |
That one should work.
I would love to see what you have done to my demo, send it to lordgraga@hotmail.com when it is done :)
#4013 - Maverick - Sat Mar 15, 2003 9:25 pm
Youre also going to need a
Code: |
while(1)
{
if(KEY_LEFT)
if(x!=0)
x--;
if(KEY_RIGHT)
x++;
if(KEY_DOWN)
y++;
if(KEY_UP)
if(y!=0)
y--;
if (x> 512 - 240))
x= 512-240;
if (y> (256 - 160))
y=256-160;
REG_BG0VOFS = y;
REG_BG0HOFS = x;
waitForVsync();
}
|
To check for the keypresses else it will only check once!