• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Script] What determines which person event is top of another while overlapping?

U.Flame

Maker of Short Games
1,326
Posts
15
Years
  • In my script, there are 2 person events involved. One is a boulder, one is an NPC, and the NPC jumps over the boulder in the script. While they do so, the boulder appears to be on top of their sprite in the parts that overlap rather than their sprite being on top of the boulder. What determines which person event appears on top of the other during an overlap like this? I tried switching their events around to see if its a priority related to the event number, but nothing changed from that.
     

    Anthroyd

    Professor
    211
    Posts
    7
    Years
  • Which direction does your NPC "jump?" I believe the draw order depends on the sprite's y position on the screen. If your NPC is jumping "downward" then it'll appear "behind" the boulder until it reaches the midpoint of the boulder's sprite, then your NPC will be drawn "in front of" the boulder. If you jump from left to right or from right to left, your sprite will appear above the boulder always. If you jump from bottom to top, your sprite will appear above the boulder during the first half of the jump, then clip behind the boulder during the second half.
     
    Last edited:

    U.Flame

    Maker of Short Games
    1,326
    Posts
    15
    Years
  • Which direction does your NPC "jump?" I believe the draw order depends on the sprite's y position on the screen. If your NPC is jumping "downward" then it'll appear "behind" the boulder until it reaches the midpoint of the boulder's sprite, then your NPC will be drawn "in front of" the boulder. If you jump from left to right or from right to left, your sprite will appear above the boulder always. If you jump from bottom to top, your sprite will appear above the boulder during the first half of the jump, then clip behind the boulder during the second half.

    Interesting. The NPC is jumping from right to left, but appears behind the boulder. Could it maybe act differently when its an NPC instead of a player, or jumping because of an applymovenent command? Well if its due to the Y position, how can I go about manipulating that?
     

    Anthroyd

    Professor
    211
    Posts
    7
    Years
  • U.Flame said:
    Interesting. The NPC is jumping from right to left, but appears behind the boulder. Could it maybe act differently when its an NPC instead of a player, or jumping because of an applymovenent command? Well if its due to the Y position, how can I go about manipulating that?
    Hmm... try changing the movement to just walking from right to left. Does the NPC switch to being drawn in front of the boulder? If so, then it certainly is based off of the y position of the sprite, because the jumping animation moves the y position upwards, above the boulders, resulting in that drawing order. If you change it from just walking right to left and the boulder is still drawn in front, then I'm probably wrong about the whole y position thing.
     

    U.Flame

    Maker of Short Games
    1,326
    Posts
    15
    Years
  • Hmm... try changing the movement to just walking from right to left. Does the NPC switch to being drawn in front of the boulder? If so, then it certainly is based off of the y position of the sprite, because the jumping animation moves the y position upwards, above the boulders, resulting in that drawing order. If you change it from just walking right to left and the boulder is still drawn in front, then I'm probably wrong about the whole y position thing.

    Yep, even walking they're still behind the boulder. I've tried every jump direction to no avail. It seems like the only time their sprite is in front is when standing directly underneath so the head is shown over the boulder. But all other movement seems to put them behind it.
     
    Last edited:

    U.Flame

    Maker of Short Games
    1,326
    Posts
    15
    Years
  • I found a workaround, but I hesitate to call this solved since the base question of "what determines which sprite is shown on top of another" remains unanswered.

    For my script, I made a duplicate tile that looks like a boulder, and swapped them around with setmaptile and movesprite commands. It works just like how I wanted it so that's good enough for me at least.
     
    Last edited:
    Back
    Top