Homebrew libnds help: moving sprite across both screens

Psyfira

Credit: 0ml. Insert tea to continue
OP
Member
Joined
Dec 31, 2003
Messages
3,886
Trophies
0
Location
England
XP
270
Country
Bit of a technical question this but worth a shot...

I've finished Patater's tutorial and realised I know enough to build something simple, like a small game of pong. But I've got myself a bit stuck trying to figure out how to get the ball to move across both screens.

libnds uses a separate space in memory for sprites for each screen. So one solution would be to create the sprite twice, once in each memory bank, and toggle the visibility depending on which screen the sprite is on. But this strikes me as somewhat inefficient, with a single sprite taking up double the amount of memory it would theoretically need.

Is this the correct way to do it, or is there a better solution than creating everything twice? I know I could just build it that way and forget about it but part of me just won't let the feeling that I'm missing something go...
 

jeremy506

Some dude.
Member
Joined
Oct 26, 2009
Messages
587
Trophies
1
Location
America
XP
183
Country
Nauru
Just check weather the sprite is below 0, and make a boolean. If it is below 0, say... "screen" = true.
Then if it is true create a new sprite on the top screen with the same X position, but the Y at 192.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    HiradeGirl @ HiradeGirl: @Sonic Angel Knight :bortz2: