Author Topic: Struggling with characters baselines  (Read 134 times)

alkis21

  • AGS rocks
    • alkis21 worked on one or more games that was nominated for an AGS Award!
Struggling with characters baselines
« on: 24 Aug 2019, 07:53 »
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?
« Last Edit: 24 Aug 2019, 08:07 by alkis21 »

Snarky

  • Global Moderator
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: Struggling with characters baselines
« Reply #1 on: 24 Aug 2019, 09:17 »
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

  • AGS rocks
    • alkis21 worked on one or more games that was nominated for an AGS Award!
Re: Struggling with characters baselines
« Reply #2 on: 24 Aug 2019, 11:06 »
Thank you very much, I had forgotten about Z property.