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 > Displaying rectangle sprites

#8455 - yaustar - Fri Jul 11, 2003 1:35 am

How would I display a rectanglar sprite, let's say 8 wide by 16 high.

I think it is done by going from this

Code:

sprites[move.sprite_no].attribute0 = COLOR_256 | SQUARE | move.y;

to
Code:

sprites[move.sprite_no].attribute0 = COLOR_256 | TALL | move.y;

or
Code:

sprites[move.sprite_no].attribute0 = COLOR_256 | WIDE | move.y;


however, do I need to store the sprite data in a different or set way?[/code]
_________________
[Blog] [Portfolio]

#8458 - tepples - Fri Jul 11, 2003 3:55 am

Everything you always wanted to know about how larger sprites are stored[1] can be found here in the CowBite spec.

Summary: In 1D mapping, large sprite cel data is stored tilewise, in left-to-right, top-to-bottom order.

Understand now?

[1] but were afraid to ask
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#8495 - yaustar - Sat Jul 12, 2003 1:17 am

Forgot (not 'forget', sorry) about 1D and 2D modes :p
Need to write a reference one of these days.....

Anyway, how does the gba know how large the sprite is if I declare it as WIDE or TALL? (Ie How the heck do I declare it?)
_________________
[Blog] [Portfolio]


Last edited by yaustar on Sun Jul 13, 2003 1:41 am; edited 1 time in total

#8498 - tepples - Sat Jul 12, 2003 5:14 am

yaustar wrote:
Anyway, how does the gba know how large the sprite is if I declare it as WIDE or TALL?

There's a lookup table within the video chip that translates shape-size pairs to width-height pairs. (Why Nintendo didn't just put height in one bitfield and width in another remains a mystery.) A wide sprite can be 16x8, 32x8, 32x16, or 64x32 pixels; transpose this for a tall sprite.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.