Struggling with characters baselines

Started by alkis21, Sat 24/08/2019 07:53:19

Previous topic - Next topic

alkis21

My game has two player characters who randomly follow each other around and can be chosen at any time at a press of a button. My problem is that I can't seem to figure out what to do with their baselines; most of the times the character who is in front is drawn in front, but sometimes that doesn't happen and it looks weird. I tried changing their baselines based on whose 'y' is higher with repeatedly execute, but with no success. Any ideas?

EDIT: I think I figured out the problem... Although all my sprites were drawn the same size, their feet are 26 pixels apart. So in the game, even though the male character may appear to be below the female, it's really vice versa. I don't suppose that there is an easier way than replacing all sprites?

Snarky

Characters have a z-coordinate, which defines where their feet are relative to the bottom of the sprite. If their feet are 26 pixels above the bottom of the sprite, set it to -26 to have them standing on the ground at the level of their baseline. (Vice versa, with a character that is meant to be floating, such as a ghost, you could make it positive to have them hover over the ground.)

alkis21

Thank you very much, I had forgotten about Z property.

SMF spam blocked by CleanTalk