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 > sprite attribute 2 and COLOR_256

#18088 - darknet - Sat Mar 20, 2004 5:20 am

I am in the midst of making a breakout clone and am just at the stage of displaying the multiple sprites on screen.

Right now, I have one brick, the paddle and the ball. The conversion tool used was gifs2sprites (its the only program that remotely gives me a good conversion) and both the paddle and ball come out fine, yet the brick's right side looks like someone took a bite out of it.

I am thinking it might have something to do with my attribute 2 settings, because it was messing with those that got the other two to show up properly. The dimensions for all of the gifs used are as follows (And each is 256 colors):

ball: 8x8
paddle: 32x8
brick: 16x8

and in the conversion file the array sizes are as follows:
palette: 34
paddle: 128
ball: 32
brick: 64

and below is my code:

Code:

 setMode(MODE_1 | OBJ_MAP_1D | OBJ_ENABLE);

   int xOne = INIT_BALL_X;
   int yOne = INIT_BALL_Y;
   int xTwo = INIT_PADDLE_X;
   int yTwo = INIT_PADDLE_Y;
   
   int xThree = 50;
   int yThree = 70;

   for(int x=0; x<34; x++) {
     SpritePal[x] = palette[x];
   }

   initalizeSprites();
 
   sprites[0].attr0 = COLOR_256 | SQUARE | yOne;
   sprites[0].attr1 = SIZE_8 | xOne;
   sprites[0].attr2 = 0;

     for(int i = 0; i<32; i++) {
           SpriteData[i] = ball[i];
      }

   sprites[1].attr0 = COLOR_256 | TALL | yTwo;
   sprites[1].attr1 = SIZE_16 | xTwo;
   sprites[1].attr2 = 2;

   for(int j = 32; j<160; j++) {
      SpriteData[j] = paddle[j-32];
   }
   
   sprites[2].attr0 = COLOR_256 | TALL | yThree;
   sprites[2].attr1 = SIZE_8 | xThree;
   sprites[2].attr2 = 10;
   
   for(int k = 160; k < 224; k++) {
      SpriteData[k] = brick[k-160];
   }


I have already tried changing the TALL/WIDE/etc portions of the attributes. With that code, as I mentioned, the ball and paddle show up fine, but the brick shows up 85% okay with the right side looking like someone ripped a chunk off of it.

Any help would be greatly appreciated, thanks so much for your time,
-Mike

#18103 - yaustar - Sat Mar 20, 2004 2:41 pm

Looks fine to me, have you checked with VBA if the sprite properties are correct?
_________________
[Blog] [Portfolio]

#18121 - darknet - Sun Mar 21, 2004 12:55 am

Upon further inspection, I put a checked with the VBA and it ends up that the entire area is actually being DRAWN, but for some reason the right side of the brick is simply being drawn as black.

I remember now that I had a similar problem before with gif conversion with gifs2sprites. However, all other popular conversion programs (pcx2sprite, gfx2gba) give me much worse. So I dunno what to do. Awhile back I started a thread on how to properly draw + convert multiple sprites, and I referred back to that and it seems as if I am doing everything right..

Anyone run into similar problems with gifs2sprites or have any tricks on their conversions?

Thanks,
-Mike

#18122 - yaustar - Sun Mar 21, 2004 1:19 am

I use gif2sprites and had no problem with it yet.
_________________
[Blog] [Portfolio]

#18159 - darknet - Mon Mar 22, 2004 12:23 am

Alright, so I am using gifs2sprites like so:

gifs2sprites 256 out.h ball.gif paddle.gif brick.gif

and, when all said and done the ball and brick actually appear perfectly. However, i a few portions of the data in the paddle look like so:

0xffffffffe

And i notice that all of the holes in my paddle being displayed are where that hex value is being outputted. So I simply change those values to whatever I found appropiate (by looking at that value's neighbors), and everything works fine.

gifs2sprites always does this with at least one of my files if its larger than 8x8. Dunno why. I am particularly dumbfounded considering no one else seems to have this problem.

Oh well, its a minor inconvienence in any case. Thanks for giving me yer 2 cents yaustar.

-Mike

#18163 - yaustar - Mon Mar 22, 2004 1:35 am

I am going out on a limb and ask whether you specified a transparnet colour in the gif file..I am not sure if it will fix your problem through.
_________________
[Blog] [Portfolio]

#18171 - darknet - Mon Mar 22, 2004 6:04 am

I did, when I created it in photoshop I made sure entry 0 was the transparent color (black in my case)...is that incorrect usage with this conversion program?

#18184 - yaustar - Mon Mar 22, 2004 2:47 pm

no, you are fine. email me the gif yaustar_8p@NOSPAMyahoo.co.uk (remove NOSPAM) and I try it :)
_________________
[Blog] [Portfolio]