#16891 - stranger - Thu Feb 26, 2004 3:05 pm
I would like to ask would it be possible to show rotating sprite under mode 4??
Actually, I want to show a rotating sprite on a static background(I can only show it in Mode 4 >____<). Could someone give me some hints to do it?
Thanks a lot
#16892 - poslundc - Thu Feb 26, 2004 3:12 pm
The only caveat to using sprites in Mode 4 (or any bitmap mode) is that the bitmap data cuts into half of the available sprite tile data, which means you can only use tile indices 512 and up.
Both of the tutorials from The Pern Project and http://www.gbajunkie.co.uk explain how to perform sprite scaling/rotation.
Dan.
#16898 - stranger - Thu Feb 26, 2004 4:49 pm
thanks for your reply.
how about my background is photo, can the rotating sprite be shown on the background in mode 4? as I don't know how to show rotating sprite in mode 4.
I only know how to show it in mode 2
///////////////////////// Sprite ////////////////////////
SetMode(MODE_2 | BG2_ENABLE | OBJ_ENABLE | OBJ_MAP_1D); for(loop = 0; loop < 256; loop++)
OBJPaletteMem[loop] = compass3Palette[loop];
InitializeSprites();
sprites[0].attribute0 = COLOR_256 | SQUARE | ROTATION_FLAG | MODE_TRANSPERANT | SIZE_DOUBLE | y;
sprites[0].attribute1 = SIZE_64 |ROTDATA(0)| x;
sprites[0].attribute2 = char_number;
for(index = 0; index < 256*8; index++)
OAMData[index] = compass3Data[index];
#16900 - stranger - Thu Feb 26, 2004 4:59 pm
thanks for your reply.
how about my background is photo, can the rotating sprite be shown on the background in mode 4? as I don't know how to show rotating sprite in mode 4.
I only know how to show it in mode 2
///////////////////////// Sprite ////////////////////////
SetMode(MODE_2 | BG2_ENABLE | OBJ_ENABLE | OBJ_MAP_1D); for(loop = 0; loop < 256; loop++)
OBJPaletteMem[loop] = compass3Palette[loop];
InitializeSprites();
sprites[0].attribute0 = COLOR_256 | SQUARE | ROTATION_FLAG | MODE_TRANSPERANT | SIZE_DOUBLE | y;
sprites[0].attribute1 = SIZE_64 |ROTDATA(0)| x;
sprites[0].attribute2 = char_number;
for(index = 0; index < 256*8; index++)
OAMData[index] = compass3Data[index];
#16901 - poslundc - Thu Feb 26, 2004 5:08 pm
stranger wrote: |
how about my background is photo, can the rotating sprite be shown on the background in mode 4? as I don't know how to show rotating sprite in mode 4.
I only know how to show it in mode 2 |
OK... I'm going to be blunt with you... do you really know how to display sprites in any mode? Have you ever tried it? Because from the look of it you've just copied and pasted the code straight from the Pern tutorials.
Displaying sprites in Mode 4 is exactly the same as displaying sprites in Mode 2, except for only being able to use tile indices 512 and up. If you don't know how to switch to Mode 4 then you need to start the tutorials over and work through them more diligently.
Dan.
#16902 - stranger - Thu Feb 26, 2004 5:32 pm
I am so sorry about using the pern code for my first try.
I have tried the sprite in mode 4
sprites[0].attribute0 = COLOR_256 | SQUARE | ROTATION_FLAG | MODE_TRANSPERANT | SIZE_DOUBLE | y;
sprites[0].attribute1 = SIZE_64 |ROTDATA(0)| x;
sprites[0].attribute2 = char_number+512;
However, I can't show the sprite in VisualBoyAdvance, but it can be shown in Mappy. I am confused about using mode 4 for rotating sprite.
Thanks
#16905 - poslundc - Thu Feb 26, 2004 7:19 pm
stranger wrote: |
I am so sorry about using the pern code for my first try. |
There's nothing wrong with using the Pern code, but when you imply that you don't know how to do something as simple as switch modes and your code is directly copied from Pern, it doesn't come across as though you've tried very much.
Quote: |
sprites[0].attribute0 = COLOR_256 | SQUARE | ROTATION_FLAG | MODE_TRANSPERANT | SIZE_DOUBLE | y;
sprites[0].attribute1 = SIZE_64 |ROTDATA(0)| x;
sprites[0].attribute2 = char_number+512; |
Is your tile data located at the 512th index of sprite memory?
Dan.
#16908 - yaustar - Thu Feb 26, 2004 8:39 pm
#16919 - dagamer34 - Fri Feb 27, 2004 12:56 am
Oh, by the way, I just thought about this. You can only use rotation indicies 16-31 since they shadow OAM sprite memory in modes 3-5.
_________________
Little kids and Playstation 2's don't mix. :(
#16923 - DekuTree64 - Fri Feb 27, 2004 4:07 am
Nope, all the rotation indices should be fine. It's only the sprite character data, not the OAM, that's cut in half. The rot/scale data is really just the combined attr3's of each set of 4 OAM entries.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#16925 - stranger - Fri Feb 27, 2004 6:57 am
Thanks.
I get some ideas about how to do it in mode 4.