Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flipping sprites?
#3
I found a document that mentions sprite flipping is supported by the NGPC in VRAM at bits 6 and 7 at offset 0x8801.

I looked over library.c to see how the sprite functions are modifying VRAM and have successfully added this function: 
Code:
void SetSpriteFlip(u8 SpriteNo, bool XFlip, bool YFlip)
{
  u8 * theSprite = SPRITE_RAM;
  theSprite += (SpriteNo * 4);
 
  switch (XFlip)
  {
 case 1:
*(theSprite+1) ^= 128;
break;
 default:
break;
  }
   switch (YFlip)
  {
 case 1:
*(theSprite+1) ^= 64;
break;
 default:
break;
  }
}

Of course, this has to be added to library.h:
Code:
void SetSpriteFlip(u8 SpriteNo, bool XFlip, bool YFlip);

This successfully flips a tile on X, Y or both.  It only works on the 1 tile specified and does not affect other tiles in a chain.  It appears that flipping a chain would require flipping each tile in the chain and changing X and/or Y positions on each as needed.  It would probably not be too difficult to come up with a function to manage flipping at the chain level.
Reply


Messages In This Thread
Flipping sprites? - by winteriscoming - 04-22-2020, 10:35 AM
RE: Flipping sprites? - by Loïc - 04-23-2020, 01:35 AM
RE: Flipping sprites? - by winteriscoming - 04-23-2020, 01:39 AM
RE: Flipping sprites? - by Loïc - 04-23-2020, 04:52 AM
RE: Flipping sprites? - by winteriscoming - 04-23-2020, 01:38 AM
RE: Flipping sprites? - by winteriscoming - 04-23-2020, 07:06 AM
RE: Flipping sprites? - by winteriscoming - 04-25-2020, 06:47 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)