N/A
Problem description:
In TOPDOWN_MAP format it seems that objects on the same tile with the same layer but different pixel offsets fight for layer dominance. How can I fix this without switching to SIDE_MAP?
Code:
N/A Problem description: In TOPDOWN_MAP format it seems that objects on the same tile with the same layer but different pixel offsets fight for layer dominance. How can I fix this without switching to SIDE_MAP? |
I have a library for standing layers here, but that's irrelevant.
Fighting for layer dominance happens when objects overlap and have the exact same layer. You can avoid this by adding a random amount to every object's layer: atom/New() Of course, this means you can't do layer equality checks (this.layer == that.layer), but who does that anyway? @toby: Don't forget to return the value in Move(). Skip that in a single override and your calls to Move() and step() won't return a usable value. |
In response to Kaiochao
|
|
You're completely right, an oversight on my part.
I'm assuming you're talking about this: mob/Move() |
In response to Kaiochao
|
|
Kaiochao wrote:
I have a library for standing layers here, but that's irrelevant. > atom/New() Of course, this means you can't do layer equality checks (this.layer == that.layer), but who does that anyway? I didn't even consider that layers could be irrational values. Thanks. :P |
Honestly, I'm not entirely sure how effective something like that would be, or even how practical. I'm assuming your problem is they are on the same block, but one is above the other?
*edit* After I posted I realized the script I supplied works in reverse of the desired effect, placing the top-most MOB's layer higher then the one below it.
There could be a better way to calculate this, but that's what I came up with. Also, I'd advice using decimals because it makes things easier when altering layers. Especially if you have objects that should always be on top.