#140170 - jonezer4 - Fri Sep 14, 2007 1:42 am
I've been developing a card game using Patatersoft's manual as a guide, but I've run into a few problems when moving on to multiple sprites as opposed to the single one in his tutorial. I have something that's close to working, but I'm certain I've made several mistakes in it, which is resulting in the fact that only my first 6 sprites work, anything after that goes to hell.
Some background. I'm using 8x8 tiled sprites, in a 1D fashion (I have 24 sprites all lined up in a straight downward line, one on top of the other) and they are each 64x64 in size. When I set up video I'm specifying sprites as "DISPLAY_SPR_1D"/
When I DMAcopy in the image data, I use this, spriteNum being which sprite image I want to copy in (0 for the top sprite, 1 for the next one down, etc.)
Note, spriteGfID is always 160, but I am putting different multiples of that into attribute[2];
So like I said, there's several things that I don't particularly understand about what's going on in there, despite having read tatersoft's manual and several posts on here, but it works, for the most part. The problem is, it only works for the first 6 sprites and then everything goes to hell, which leads me to believe I'm doing something horribly wrong. I'd like to have a better understanding of all this stuff too, instead of just hacking until it halfway works. Any help or guidance would be greatly appreciated. Thanks!
Some background. I'm using 8x8 tiled sprites, in a 1D fashion (I have 24 sprites all lined up in a straight downward line, one on top of the other) and they are each 64x64 in size. When I set up video I'm specifying sprites as "DISPLAY_SPR_1D"/
Code: |
short int spriteGfxID = 160; //Don't understand why it's this. It's 64 in patater's manual, but that gave me strange results
for (int n = 0; n < 6; n++) //HACK 6 the most that works currently { spriteEntry[n].attribute[0] = ATTR0_COLOR_256 |ATTR0_ROTSCALE_DOUBLE;// | //able to rotscale //in tater's manual he specifies the y position here, but that gave me strange results when rotating spriteEntry[n].attribute[1] = ATTR1_ROTDATA(0) | ATTR1_SIZE_64| //size 64x64 n*64*8; //This was just the x position in pater's manual, but that gave me weird results when rotating. Again, this appears to work, but I don't really know why. spriteEntry[n].attribute[2] = spriteGfxID * (n); //I thought this should be spriteGfID squared times n, but that doesn't work } |
When I DMAcopy in the image data, I use this, spriteNum being which sprite image I want to copy in (0 for the top sprite, 1 for the next one down, etc.)
Code: |
//copy the sprite graphics in obj graphics mem
dmaCopy(SPRITE_BIN+(spriteNum*64*64), &SPRITE_GFX[spriteGfxID * 16 * spriteNum], //to address 64*64); //size |
Note, spriteGfID is always 160, but I am putting different multiples of that into attribute[2];
So like I said, there's several things that I don't particularly understand about what's going on in there, despite having read tatersoft's manual and several posts on here, but it works, for the most part. The problem is, it only works for the first 6 sprites and then everything goes to hell, which leads me to believe I'm doing something horribly wrong. I'd like to have a better understanding of all this stuff too, instead of just hacking until it halfway works. Any help or guidance would be greatly appreciated. Thanks!