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.

Beginners > explain me this please!

#58019 - ghost Leinad - Thu Oct 20, 2005 3:26 am

i want you to explain me the sprites header (gbasprites.h or smt), with all the attributes, the structures and stuff; and the MoveSprite() function :D, how is related to the sprites header.

but please, use plain and simple words, i need to explaind this to a friend but i don't know how!!

tanx in advance

BTW, im trying to buy a flash linker, and here in Mexico that stuff worth 1800 pesos, (about 150 dollars), it is my imagination or the price is just too high!!
the blank cartridges are sold in 900 pesos ($70 dollars)
_________________
All human wisdom is summed up in these two words, - 'Wait and hope"
****************************************
My site www.myth-world.net and www.bmrpg.com :)

#58047 - Fatnickc - Thu Oct 20, 2005 1:03 pm

To my knowledge it shouldn't be in the header at all. Wherever I've seen tutorial code, it has always been defined only in the programs where it was needed. There's some rotation structs in the header, but, for me at least, not MoveSprite();.

#58096 - crossraleigh - Thu Oct 20, 2005 8:31 pm

The sprite's X coordinate is in the first 9 bits of Attribute 1, while the Y coordinate is in first 8 bits of Attribute 0. When you set them, you should make sure not to overwrite the other information in the attributes. So, a MoveSprite() function made to work with libgba might look like this:

Code:
void MoveSprite(OBJATTR* sprite, int x, int y)
{
   sprite->attr0 &= 0xFF00;
   sprite->attr0 |= y;

   sprite->attr1 &= 0xFE00;
   sprite->attr1 |= x;
}

A section in GBATEK tells more about the sprite attributes.

A 256 Mb EFA-Linker (which is a flash cartridge with a writer) should only cost $70 USD.

Hope that helps.
_________________
My world is black and white, but if I blink fast enough, I see it in grayscale.