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 > Have multiple instances of the same sprite.

#153389 - TheMagnitude - Sat Mar 29, 2008 3:03 pm

How do I load only one instance of each sprite, like a bullet for example, and then have multiple bullets in different positions on the same screen at once?

Is this even possible?

#153393 - Lick - Sat Mar 29, 2008 3:20 pm

Use multiple sprite objects, but point them to the same graphics block.
_________________
http://licklick.wordpress.com

#153403 - TheMagnitude - Sat Mar 29, 2008 7:20 pm

Im new to DS dev, how would I do that? Do i have to refer to SPRITE_GFX[]?

#153405 - tepples - Sat Mar 29, 2008 7:59 pm

Just load one bullet into SPRITE_GFX the normal way, and then make a whole bunch of bullets that use the same value in attribute 2 as the bullet you just loaded.

Have you ever programmed for NES, Game Boy, Super NES, or GBA?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#153408 - silent_code - Sat Mar 29, 2008 8:42 pm

you need to assign the same graphics id (the index of the first tile) to all instances. read up on that (tonc).

happy coding!