Homebrew Homebrew game Citro2D sprite z-order

  • Thread starter Thread starter BlyZe
  • Start date Start date
  • Views Views 421
  • Replies Replies 0

BlyZe

Active Member
Newcomer
Joined
Sep 19, 2024
Messages
25
Reaction score
14
Trophies
0
Age
21
Location
North Rhine Westphalia
Website
github.com
XP
419
Country
Germany
I want to render sprites in specific order so one sprite is layered above the other.
But for some reason it doesn't work like I thought.

First I tried just rendering the above sprite after the underlying sprite.
C:
C2D_TargetClear(topPtr, C2D_Color32(0, 0, 0, 255));
       
C2D_SceneBegin(topPtr);
renderSprite(&sun, frames); //Sun
renderSprite(&ground, frames);
renderSprite(&groundExt, frames);

for (size_t i = 0; i < MAX_CLOUDS; i++)
{
    curCloudPtr = &clouds[i];
    if (curCloudPtr->frames[curCloudPtr->curIndex].params.pos.x >= -curCloudPtr->hitbox.width
        && curCloudPtr->frames[curCloudPtr->curIndex].params.pos.x <= TOP_SCREEN_WIDTH)
    {
        renderSprite(curCloudPtr, frames); //This should be rendered above the sun that's rendered first
    }
}
renderSprite(&player.sprites[player.state], frames);

C3D_FrameEnd(0);

Then I tried messing with
C:
C2D_SpriteSetDepth();
but that had no effect either.

Any idea why that's the case?
Any help is appreciated :yay3ds:
 

Site & Scene News

Popular threads in this forum