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.

Coding > 256 Color Sprite

#98927 - PolyStream - Fri Aug 18, 2006 3:47 pm

Hi,

this is my firts post!
This community is really amazing! Good job!

My problem is to using 256 color sprites.

I've coded a small game like pong
http://digilander.libero.it/blizzard.3dDevelop/bba.html

In this game I use 16 color palette sprites.

I've tryed to use 256 colors but I have some errors in the rendering!
I think I visualize only parts of the sprites....
Please, can anyone can explain to me the right way to load a 256 color sprite in the OAM and show it correctly setting attributes and other features?

Another thing! I've also problems with the rotation of the sprites! what is the code to rotate it correctly?

Sorry but I'm just a beginner... I hope you want to help me!

Thanks

bye
Giovanni
_________________
#include <YourPassion.h>

#98955 - psycorpse - Fri Aug 18, 2006 6:34 pm

PolyStream,

It may be helpful if you paste your code so that we can see what you are doing.

I do have some questions that would be answered in your code but since it isn't, here are my questions

In the OAM.attribute0 did you change the colors to 256 instead of 16?

Did you change your tile index in OAM.attribute2 to point to the correct tile?



You should check out TONC for the rotation information.

#98957 - PolyStream - Fri Aug 18, 2006 6:57 pm

you're right!

here's the code

sprite.h
Code:
//256 Color Tile Graphics, Tile Size: 30x20, Tiles Used: 600
                     
const u16 sprite_gfx[19200] = {
0xFCFC,0xFCFC,0xFCFC,0xFCFC,0xFCFC,0xFCFC,0xFCFC,0xFCFC,
0xFCFC,0xFCFC,0xFCFC,0xFCFC,0xFCFC,0xFCFC,0xFCFC,0xFCFC,....................

//Palette, Colors Used: 256
const u16 sprite_pal[256] = {
0x0000,0x0010,0x0200,0x0210,0x4000,0x4010,0x4200,0x6318,
0x6378,0x7B34,0x0088,0x008C,0x0090,0x0094,0x0098,0x009C,
0x0100,0x0104,0x0108,0x010C,0x0110,0x0114,0x0118,0x011C,.............................


main.c
Code:

....
......
...
REG_DISPCNT = 0x1404;  //mode set
memcpy(((void *)0x6014000),sprite_gfx,16384);
memcpy(((void *)0x5000200),sprite_pal,sizeof(u16) * 256);
PALETTE[0] = BGR(0x1f,0,0);
.......
...
....
x = 50;
y = 50;
iAnim = 0x208;

OAM[0][0] = y|(0 << 14) | (1<<13);                                                                 
OAM[0][1] = x|(2 << 14);
OAM[0][2] = iAnim;
..
....


Here is some code that may set my sprite with 256 colors!
I don't know what's wrong!

thanks
Bye
_________________
#include <YourPassion.h>

#98960 - tepples - Fri Aug 18, 2006 7:06 pm

Could you post images of VBA's tile viewer and OAM viewer?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#98962 - PolyStream - Fri Aug 18, 2006 7:28 pm

hi,

Now I've not the time to upload on my site the screenshot.

I've seen the tileviewer of the visualboy advance, so I've seen that the image with all tiles is all destroyed... deformed, it's not sequential!

I'll upload the screen soon as I can

Bye
_________________
#include <YourPassion.h>

#99006 - psycorpse - Sat Aug 19, 2006 1:09 am

PolyStream wrote:
hi,

Now I've not the time to upload on my site the screenshot.

I've seen the tileviewer of the visualboy advance, so I've seen that the image with all tiles is all destroyed... deformed, it's not sequential!

I'll upload the screen soon as I can

Bye


What converter are you using to convert the graphics?

#99054 - PolyStream - Sat Aug 19, 2006 8:49 am

Hi,

I've used kaleid 1.2.4 for the sprite creation
_________________
#include <YourPassion.h>