Using all 4 layers in 2D mode
Posted: Fri May 25, 2018 2:30 pm
Hi,
I'll quickly render the problem: what I want to do is to have:
1) Console and HUD made of sprites rendered on OBJPRIORITY_0 (the most top level)
2) Tilemap background rendered on OBJPRIORITY_3 (the most bottom level)
3) Some sprites on OBJPRIORITY_1 (middle-top level)
4) Some sprites on OBJPRIORITY_2 (middle-bottom level)
For now I was just rendering all on OBJPRIORITY_0 or OBJPRIORITY_3, not using the middle layers, but let's say sprites rendered above console or in-game items like shotgun rendered under main character don't satisfy me anymore .
I made some changes in code, however, what my code renders after setting OBPRIORITY_1 and OBJPRIORITY_2 is:
What it should render (I screenshoted using OBJPRIORITY_0 and OBJPRIORITY_3) is:
Here's the code:
Initialising bg:
Initialising video:
Initialising console:
Initialising sprites:
I've found a similiar problem for mine:
https://stackoverflow.com/questions/993 ... -ds/994026
But I can't make anything out of answer: "layer 0 and 1 are normal and 2 and 3 are extended. I dont know what extended means. If you want to just do normal tile stuff you probably want to bgInit 0 and 1 not 1 and 2."
Also, I experimented a bit with different video modes and bit mappings like this one:
However, no results.
Thanks
I'll quickly render the problem: what I want to do is to have:
1) Console and HUD made of sprites rendered on OBJPRIORITY_0 (the most top level)
2) Tilemap background rendered on OBJPRIORITY_3 (the most bottom level)
3) Some sprites on OBJPRIORITY_1 (middle-top level)
4) Some sprites on OBJPRIORITY_2 (middle-bottom level)
For now I was just rendering all on OBJPRIORITY_0 or OBJPRIORITY_3, not using the middle layers, but let's say sprites rendered above console or in-game items like shotgun rendered under main character don't satisfy me anymore .
I made some changes in code, however, what my code renders after setting OBPRIORITY_1 and OBJPRIORITY_2 is:
What it should render (I screenshoted using OBJPRIORITY_0 and OBJPRIORITY_3) is:
Here's the code:
Initialising bg:
Code: Select all
global::bg_main_address = bgInit(OBJPRIORITY_3, BgType_Text8bpp, BgSize_B8_512x512, 22, 4);
global::bg_sub_address = bgInitSub(OBJPRIORITY_3, BgType_Text8bpp, BgSize_B8_512x512, 18, 4);
Code: Select all
videoSetMode(MODE_0_2D);
videoSetModeSub(MODE_0_2D);
Code: Select all
consoleInit(global::printConsole, OBJPRIORITY_0, BgType_Text4bpp, BgSize_T_256x256, map_base, tile_base, true, false);
Code: Select all
switch (l) {
case (LAYER_LEVEL::BOTTOM):
spriteEntry->priority = OBJPRIORITY_3;
break;
case (LAYER_LEVEL::MIDDLE_BOT):
spriteEntry->priority = OBJPRIORITY_2;
break;
case (LAYER_LEVEL::MIDDLE_TOP):
spriteEntry->priority = OBJPRIORITY_1;
break;
case (LAYER_LEVEL::TOP):
spriteEntry->priority = OBJPRIORITY_0;
break;
default:
spriteEntry->priority = OBJPRIORITY_0;
break;
}
https://stackoverflow.com/questions/993 ... -ds/994026
But I can't make anything out of answer: "layer 0 and 1 are normal and 2 and 3 are extended. I dont know what extended means. If you want to just do normal tile stuff you probably want to bgInit 0 and 1 not 1 and 2."
Also, I experimented a bit with different video modes and bit mappings like this one:
Code: Select all
videoSetMode(MODE_0_2D |
DISPLAY_BG0_ACTIVE |
DISPLAY_BG1_ACTIVE |
DISPLAY_BG2_ACTIVE |
DISPLAY_BG3_ACTIVE);
Thanks