#25914 - strider - Tue Aug 31, 2004 4:55 pm
Okay i have a lot of questions so plz be patient :)
I was wondering how to calculate the size of a sprite/image so that you can put it in attribute 2 of a sprite. For example i was following Ebbesen's tutorial on making pong; he stores an 8x8 sprite for a ball and when he adds a paddle sprite, he does:
sprites[1].attribute2 = 512 + 8;
how do you get the '+ 8'? i figured it was from the size of the sprite, however when i was trying my hand at animating sprites, i loaded in 7 frames each 64x64, and i tried incrementing attribute2 for each successive sprite by 64 but that didn't work so i had to increment by 128, i'm not really sure why this works but it did:
sprites[0].attribute2=0;
sprites[1].attribute2=128;
sprites[2].attribute2=256; etc...
so how do you calculate the address of the next sprite?
Next I realized that since the character name in sprites[].attribute2 is only 10 bits long the largest character name/address you can enter is 1024. If you're incrementing by 128 (see above) then you can only store so many frames in memory, and then you'd have no more space left for like enemy sprites and various other sprites, am i correct? if i am then how do you go about swapping in and out sprite data from the sprite space (0x06010000)?
Finally, a lot of sprites i've seen ripped from GBA games (ie. castlevania, mario) have sprites that don't quite fit any of the 16x16, 32x32, 64x64, etc. sizes. ex. sometimes a sprite will take up like 18x24 pixels or 43x50 pixels...so would you just use the next biggest size that fits? ie. in the first case make it a 32x32 sprite and in the second case a 64x64 sprite? there is a lot of blank/empty space if you do this and it seems like a waste...I was wondering how you handle these type of sprites.
anyways, thats a lot of questions, i hope they all make some sense. any help would be greatly appreciated whether you know the answer or could point me to a tutorial or something that would explain one of the topics specifically...thanks!
I was wondering how to calculate the size of a sprite/image so that you can put it in attribute 2 of a sprite. For example i was following Ebbesen's tutorial on making pong; he stores an 8x8 sprite for a ball and when he adds a paddle sprite, he does:
sprites[1].attribute2 = 512 + 8;
how do you get the '+ 8'? i figured it was from the size of the sprite, however when i was trying my hand at animating sprites, i loaded in 7 frames each 64x64, and i tried incrementing attribute2 for each successive sprite by 64 but that didn't work so i had to increment by 128, i'm not really sure why this works but it did:
sprites[0].attribute2=0;
sprites[1].attribute2=128;
sprites[2].attribute2=256; etc...
so how do you calculate the address of the next sprite?
Next I realized that since the character name in sprites[].attribute2 is only 10 bits long the largest character name/address you can enter is 1024. If you're incrementing by 128 (see above) then you can only store so many frames in memory, and then you'd have no more space left for like enemy sprites and various other sprites, am i correct? if i am then how do you go about swapping in and out sprite data from the sprite space (0x06010000)?
Finally, a lot of sprites i've seen ripped from GBA games (ie. castlevania, mario) have sprites that don't quite fit any of the 16x16, 32x32, 64x64, etc. sizes. ex. sometimes a sprite will take up like 18x24 pixels or 43x50 pixels...so would you just use the next biggest size that fits? ie. in the first case make it a 32x32 sprite and in the second case a 64x64 sprite? there is a lot of blank/empty space if you do this and it seems like a waste...I was wondering how you handle these type of sprites.
anyways, thats a lot of questions, i hope they all make some sense. any help would be greatly appreciated whether you know the answer or could point me to a tutorial or something that would explain one of the topics specifically...thanks!