SGDK - Correct time to call VDP_setPlanSize?
Moderator: Stef
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
SGDK - Correct time to call VDP_setPlanSize?
Hi,
I'm trying to resize the planes' size to 64x64 by calling VDP_setPlanSize(64,64) but it doesn't seem to have any effect. It looks like it still thinks it's in 32x32. Is the function not working because I can only call it at certain times?
I'm expecting my background to look like this (warning: gross simplification ahead)
0000000000000000
1111111111111111
2222222222222222
3333333333333333
But I'm getting this instead
00000000 // lines are stopped half-way and continues on the next line
00000000
11111111
11111111
// also cuts out the bottom half of the map.
I'm also calling VDP_setScreenHeight224() and VDP_setScreenWidth320() which I don't know if they would affect it.
What could I be missing?
Thanks!
DJCC
I'm trying to resize the planes' size to 64x64 by calling VDP_setPlanSize(64,64) but it doesn't seem to have any effect. It looks like it still thinks it's in 32x32. Is the function not working because I can only call it at certain times?
I'm expecting my background to look like this (warning: gross simplification ahead)
0000000000000000
1111111111111111
2222222222222222
3333333333333333
But I'm getting this instead
00000000 // lines are stopped half-way and continues on the next line
00000000
11111111
11111111
// also cuts out the bottom half of the map.
I'm also calling VDP_setScreenHeight224() and VDP_setScreenWidth320() which I don't know if they would affect it.
What could I be missing?
Thanks!
DJCC
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
A spammer hit the forum this morning - Edisonrose - you can still see a couple of his posts on the board.djcouchycouch wrote:I occasionally get email updates about this thread even though there aren't actually any updates. Forum problem? Spammer getting booted before I check?
Also, I wish I had explained what my actual problem above was
But the post above yours by oofwill is real.
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
oofwill wrote:If i understand, a plan is 64 tiles wide (512pxls)
So, what is the method to use a big map, as in goplanes for exemple?
I don't really inderstand this thing...
If your level size is better than the plane size, then you can only put part of the level in the plane.
Example level:
[1][1][1][1][1][1][1]
[2][2][2][2][2][2][2]
[3][3][3][3][3][3][3]
[4][4][4][4][4][4][4]
Example Plane:
[][]
[][]
When you first show the level, copy only the area that fits into the plane. If the player is at the top left corner of the map, then your plane will look like:
[1][1]
[2][2]
Next is scrolling, which is tricky because you have to realize that planes, when scrolled in a direction farther than their width/height, wrap around.
Example Plane Filled with your tile data:
[1][2][3][4][5]
[1][2][3][4][5]
[1][2][3][4][5]
[1][2][3][4][5]
If you scroll the plane horizontally forever, it'll look like the level loops for infinity:
[1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5]...
[1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5]...
[1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5]...
[1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5][1][2][3][4][5]...
it'll loop that one part of the level you copied to the plane. But you want to make it look like you're scrolling through the level. In Goplanes, I use one method for doing that.
To do that, you need to update the row and columns just outside the screen in the direction of movement.
Player starts standing:
[1][2][3][4][5]
[1][2][3][4][5]
[1][2][3][4][5]
[1][2][3][4][5]
Player moves towards the right:
[1][2][3][4][5][6] <- new column!
[1][2][3][4][5][6]
[1][2][3][4][5][6]
[1][2][3][4][5][6]
You copy the column from your level data to the plane just outside of the screen so that when the plane scrolls it looks seamless.
You'll need to keep in mind the case where you're adding a row or column at the border of the plane. Writing past a plane in memory will overwrite the next plane or whatever memory that comes after.
That's the very quick version of it.