Main Character drawn behind NPC

Started by jhonberg, Tue 26/06/2018 21:25:21

Previous topic - Next topic

jhonberg

How can i set the index for the NPC characters they seem the be in front of the main player i don't understand what's wrong here...
It's clear not intuitive what to do... :undecided:

Can some one give me hand here  what am i missing here???  some one said  Did you modified object baseline? charcters don't have a base line property on the dash board, so i'm clueless here..

Is there property here that helps with that??   How can i set this :(
Thanks in advance.

jhonberg

This is so lame...  i just added some code on the event block when the room starts and modify the base line number...  I can't believe i had to do that by the code, how come this is not a property of an object? is this really the only way?



dayowlron

The character does have a baseline, however it has to be set in code I think.
try putting in the repeatedly_execute function the baseline of one of the two so that the mushrooms characters baseline is above the players.

EDIT: guess i wasn't fast enough.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Crimson Wizard

#3
jhonberg, you should not be changing Baseline of the playable character except for the very specific cases.
By default character's baseline gets automatically synced with their Y coordinate, so it changes as chacter walks up and down.
If you manually lock baseline at certain value, you will get other issues sooner or later, because there may be other objects, NPCs and walk-behinds in the room.

In this situation changing NPC's baseline should be sufficient.

Why there is no baseline property for characters: as mentioned above, usually character's baseline is matching character's Y coordinate. There are quite limited cases when you need to adjust one. So probably author of AGS did not think it is important, of forgot about it.
In your case, I'd rather try to find out why is it that the mushroom being visually higher than player still was draw before him. Is there a strip of transparent pixels at the sprite's bottom, or mushroom is a part of larger image, or something like that?

Khris

Characters are drawn back to front, based on their baseline. When two Characters have the same baseline, the result is arbitrary - possibly based on the character's ID (since the sorting algorithm doesn't have anything else to go on).
Like others have pointed out, a fixed baseline makes no sense for Characters in 99% of cases, that's why there's no property in the editor.

One way to ensure proper drawing in your case is to reduce the walkable area; it shouldn't cover the entire ground anyway since a character's feet extend beyond her pivot pixel.
If that's not enough for some reason, another way to fix this is to move the character position up by for instance 5 pixels, then change their .z to a negative value like -5 (again in script). That way the sorting uses the lower Y coordinate but the character is still drawn at the same spot.

jhonberg

Thank you guys, your hints and explanation made realize why  they character base line was higher, i forgot to Trim the mushroom sprite so it occupies more space as you can see, i fixed that and now Baseline and Y position does the trick.



THank you.

SMF spam blocked by CleanTalk