#17145 - darknet - Tue Mar 02, 2004 10:50 am
I have read most of the forum posts and was in the middle of the pern project and gbajunkies tutorial.
Is there a particular way one should go about taking their individual sprites and putting them on one .bmp (so I can have one sprite palette)? My method has been failing by always displaying the second (of 2) sprite as junk..
Here's what I do
1. Create individual sprites
2. Convert them using pcx2sprite
3. Create a new image that is twice as wide or high as the two individual sprite images (for example, I have 2 16x16 sprites, so the new bitmap is 16x32 and I just put one sprite above the other)
4. Convert the new bitmap with pcx2sprite
5. include the combined palette and the two individual data sections that were converted earlier
6. Stick it in the following code:
This is pretty much a direct translation of GBAJunkie's chapter 4 tutorial and I always get crap for the second image I plugged in his sprite data files into my project and they worked fine...so the only thing i can assume is that I am making an error in the way I am combining sprites.
pcx2sprite has been reliable otherwise in my project as well...
Any help or insight would be greatly greatly appreciated...
thanks,
-Mike
Is there a particular way one should go about taking their individual sprites and putting them on one .bmp (so I can have one sprite palette)? My method has been failing by always displaying the second (of 2) sprite as junk..
Here's what I do
1. Create individual sprites
2. Convert them using pcx2sprite
3. Create a new image that is twice as wide or high as the two individual sprite images (for example, I have 2 16x16 sprites, so the new bitmap is 16x32 and I just put one sprite above the other)
4. Convert the new bitmap with pcx2sprite
5. include the combined palette and the two individual data sections that were converted earlier
6. Stick it in the following code:
Code: |
int xOne = 8; int yOne = 30; int xTwo = 8; int yTwo = 50; //load sprite Palette for(int x=0; x<256; x++) { SpritePal[x] = bothPalette[x]; } initializeSprites(); //set the attributes. sprites[0].attr0 = COLOR_256 | SQUARE | yOne; sprites[0].attr1 = SIZE_16 | xOne; sprites[0].attr2 = 0; //load the particular sprite data for(int i = 0; i<128; i++) { SpriteData[i] = ballData[i]; } sprites[1].attr0 = COLOR_256 | SQUARE | yTwo; sprites[1].attr1 = SIZE_16 | xTwo; sprites[1].attr2 = 8; for(int j = 128; j<256; j++) { SpriteData[j] = ballYData[j-128]; } |
This is pretty much a direct translation of GBAJunkie's chapter 4 tutorial and I always get crap for the second image I plugged in his sprite data files into my project and they worked fine...so the only thing i can assume is that I am making an error in the way I am combining sprites.
pcx2sprite has been reliable otherwise in my project as well...
Any help or insight would be greatly greatly appreciated...
thanks,
-Mike