gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Using same sprite on both screen

#56430 - blaow - Sat Oct 08, 2005 6:46 pm

Im trying to pass a sprite from one screen to another (lower to upper) using PA_LIB by simple setting the screen attribute of the sprite to 1 (upper screen) when the transition needs to occur and then calling the PA_SetSpriteXY method. basicly as follows:

enemy.screen=1;
PA_SetSpriteXY(enemy.screen,enemy.id,enemy.x,enemy.y);

Once the transition is done the collision mechanism of the game detects the sprite in the new screen(collisions work where the sprite should be), however the sprite is still drawn on the lower screen.

Is this the way it should be done? or do i have to create a new sprite to mimic the other(one sprite in each screen that represent a single one)

thanks for any help
_________________
blaow~~

#56455 - Mollusk - Sat Oct 08, 2005 9:06 pm

you have to create copy of the sprite on the other screen...

I made a very simple example (frisbee demo, in the latest versions of PAlib)...

There is no screen attribute to a sprite. Each screen has it's own sprites...
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#56473 - blaow - Sat Oct 08, 2005 10:26 pm

Thanks for clarifying that Mollusk,
To bad there isnt a way for sharing sprites between screens. Thanks for pointing out the frisbee example, saw it once but already forgot about it.

Case closed pretty much i guess.

thanks
_________________
blaow~~

#56615 - cybereality - Mon Oct 10, 2005 4:29 am

Yeah, I was wondering the same thing, but Im not using PA_Lib. Using just ndslib is there a way for the second screen to read from the first screens buffers? It seems like a waste of RAM to have to mirror all the assets in both screen buffers.
_________________
// cybereality

#56635 - Mollusk - Mon Oct 10, 2005 7:56 am

It's not really a waste of ram, as both screens have seperate VRAMs anyway...
So you can't read directly from one screen to the other's VRAM, you have to mirror everything... And the DS has so much more ram than the gba, that it doesn't feel that bad (gba was sometimes a pain...)
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...