about sprites in a walkcycle

Started by HandsFree, Tue 26/03/2013 11:29:19

Previous topic - Next topic

HandsFree

Most sprites in the walkcycles have the feet touching (or almost touching) the base of the graphic. But some have the character 'floating' in the picture with quite some transparent pixels between the feet and the base of the graphic.
I expected the character to jump around because of this but that's not happening. The behaviour around the edges of different walkable areas is however very unpredictable (for me).

Does AGS see the character's y-coordinate as the lowest non-transparent part of the sprite? Should all sprites in a walk cycle be cropped to have the feet touch the base, or is that not important?

thanks

Billbis

Quote from: HandsFreeDoes AGS see the character's y-coordinate as the lowest non-transparent part of the sprite? Should all sprites in a walk cycle be cropped to have the feet touch the base ?
Short answers: No, Yes.
But you can also play with character Z coordinates, by giving them negative values on game start.

Khris

What do you mean by "jump around"? Are you talking about the sprite moving up and down?
Also, what is "very unpredictable"? Could you explain this better?

Also: No, No.

A walk cycle sprite where none of the feet touch the ground should absolutely NOT be cropped like that. Character sprites are positioned using the bottom center of the entire sprite (no matter which pixels are transparent), which means you can extend animation sprites upwards or horizontally (& symmetrically) as much as you want, and they will remain aligned. The bottom edge must remain at a constant distance form the character's "center" though.

If a character is supposed to float, you can either add the same amount of transparent lines to the bottom of all sprites, or use the character's .z, like Billbis explained. That way, their x/y position in the room is still below them (in a 3D sense) and they will get drawn properly in relation to walkbehinds and other characters and objects.

HandsFree

The character is not supposed to float, just walk normally. But I noticed some sprites have the feet touching the bottom edge and others don't. I thought that would make the character 'jump' at the frame where the feet don't touch the  bottom edge, but that doesn't seem to happen (or the effect is too small to notice).

We have walkable areas that are set to display different 'areaspecific' views. Sometimes a character is visually standing on walkable area 1 while it displays the view that goes with walkable area 2. I thought that might have something to do with the character's feet not touching the bottom edge in some frames. Would it be plausible that that's the cause?

I can't use the z-property for this because it's not the same for every sprite.


Snarky

Yes, the frames are aligned according to the bottom edge, so if some sprites have more transparent space at the bottom than others, it will shift that frame up. If that's not intended, you should crop the sprites to align the feet. In general, I wouldn't have transparent pixels along the bottom of a character sprite if it's supposed to have its feet on the ground, because there'll be a mismatch between the position recognized by the game and its apparent visual position, and this will mess up things like scaling, walkbehinds, and region effects (as you mention).

I find it's best to make all the frames of character animation cycles the same size, with the feet touching the bottom edge, and the character aligned between frames. That makes it easy to preview outside of the game.

Khris

Just to clarify, when I said
QuoteA walk cycle sprite where none of the feet touch the ground should absolutely NOT be cropped like that.
I was talking about a sprite that is intended to have the feet off the ground (like in a running animation) as opposed to one that's just badly cropped.
Ground != bottom edge of sprite, at least not necessarily.

If you have a high res sprite that has a certain amount of depth at the bottom, as in, the drawn feet extend below the actual position, just experiment with setting the .z value to something negative in game_start.
Quote from: HandsFree on Tue 26/03/2013 12:40:02I can't use the z-property for this because it's not the same for every sprite.
Yes you can, you just need to fix the sprites. All animation sprites need to be aligned properly anyway, or am I missing something?

Snarky

Quote from: Khris on Tue 26/03/2013 13:31:34
Just to clarify, when I said
QuoteA walk cycle sprite where none of the feet touch the ground should absolutely NOT be cropped like that.
I was talking about a sprite that is intended to have the feet off the ground (like in a running animation) as opposed to one that's just badly cropped.
Ground != bottom edge of sprite, at least not necessarily.

Isn't the simplest way to think of it that the bottom of the sprite is the ground (for character sprites, anyway), so there should only be transparent pixels under the feet if they are off it? (Though, as you say, there's an issue with aligning walk cycles/standing poses in different directions, if the forward cycle needs another row at the bottom for the feet in perspective. Leaving the row(s) of transparent pixels and setting z negative is the solution, as you say.)

Khris

Sure, usually bottom is ground. But not for a top down character, or an object with a lot of depth, or a floating character, etc.

But we have narrowed it down to misaligned sprites anyway, I guess.

HandsFree

Thanks everyone.
Quote from: Khris on Tue 26/03/2013 14:43:45
But we have narrowed it down to misaligned sprites anyway, I guess.
Yes, I think we'll need to have a closer look at alignment in all those walking sprites.

SMF spam blocked by CleanTalk