How to update sprite attributes?

slinga

Established Member
Hey guys,

I'm making (slow) progress on my game. I've got sprites working, and moving around the screen without a hitch. Now I'm working on some fancier stuff. How do I flip a sprite?

Looking at Reinhart's animation source:

Code:
SPR_ATTR attr[] = {

	SPR_ATTRIBUTE(0,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),	

	SPR_ATTRIBUTE(1,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),	

	SPR_ATTRIBUTE(2,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),	

	SPR_ATTRIBUTE(3,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),	

	SPR_ATTRIBUTE(4,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),	

	SPR_ATTRIBUTE(5,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),	

	SPR_ATTRIBUTE(6,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprHflip),	

};

It's obvious you have to use the sprNoFlip and sprHflip commands. Instead of having multiple definitions for everything, shouldn't there be a way to change the option on the fly?

I've tried sompething like this:

Code:
SPR_ATTRIBUTE(6,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprHflip);

and

Code:
attr[6] = SPR_ATTRIBUTE(6,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprHflip);

But those don't compile. I move sprites around the screen in a similar way, but that works. Any advice? Also, what doc discusses sprites in C? Thanks in advance.
 

slinga

Established Member
Thanks CWX, it works, but with a weird warning: main.c:360: warning: large integer implicitly truncated to unsigned type.

Any word on which docs you pulled this info from? Or at minimum the struct defintions?
 
Any word on which docs you pulled this info from? Or at minimum the struct defintions?

I got it from sl_def.h. It looks like sprHflip has a value that doesn't normally fit in dir. I'm guessing SPR_ATTRIBUTE gets around that problem by anding the value by 0x0F3F. So if you really find the warning annoying, try doing that.

Cyber Warrior X
 

mrkotfw

Mid Boss
try this:

Code:
if (character_flip != '\0') {

  attr[6] |= sprHflip;

} else {

  attr[6] &= ~sprHflip;

}
 
Sorry for bumping an old thread but I'm facing the same issue and none of the posts actually fixed the problem.

Maybe one of you guys got it working ?

Using the Rockin-B game tutorial this is the part of the code I want to modify :

Code:
        if((push & PER_DGT_TL) == 0) {

       	if(--current < 0)

                current = 4;

     	//   	SPR_ATTR SON =

                attr_SON[3].dir = (sprHflip&0x0f3f);

The code compiles fine but it's not working in the demo. I can't get the Sprites to Hflip. :/

Any suggestions ?
 
Hi,

I saw your PM, I did a basic tutorial for sprites manipulation in www.segasaturno.com it's a spanish web for saturn. You don't know spanish?, it's not a problem because the code is in english; you can download the code too.

Tutorial

I will release the new version beta.

I making a 2D engine for saturn, including tools for sprite packing and level editors. The big problem is the Sound!

The posible next games are:

Splatter House, Sunset Riders or Lethal Enforces I
 
Thank you for responding FacundoARG.
smile.gif


Also, this is AMAZING ! Good job !

Thank you so much for a detailed tutorial. I'll translate it np.

Funny that I'm using Sonic as well for animation. I'm thinking of Maybe trying to port the CD version to saturn lol.

But who knows.

Looking forward to the beta version and the engine as well.
smile.gif
 
Top