• 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.

[Question] [SOLVED] How to put more priority/ '.z' to the player?

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
  • I would like to know how to put the player to have more priority than Dependents and other Events when the player AND the event (Dependent or not) are facing down (direction==2):
    W7I2dDd.png


    Thank you!
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Bump

    Unfortunately am still stack with that "problem". You can check the difference between them:

    yndpA12.png


    If player and follower pokémon is facing up (direction==8) is fine but I would like to make a code when facing down (direction==2).
     

    Boonzeet

    Pokémon Secrets of the Ages Developer
    188
    Posts
    15
    Years
  • The z-index is determined by sprite height, which is what you're seeing with the following Pokémon. This can be found in Game_Character.

    Look for the line return z + ((height>32) ? 31 : 0) and add this above it:

    Code:
    if self == $game_player
      return z + 32
    end

    This will ensure the player always appears in front of larger sprites at the same MapY, no matter the size.

    Edit: You can add && self.direction == 2 to the if rule, if you did want to make it directional, but it looks best always in front.
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • I just need to double check from HGSS about the priority but it is done.
    Code:
      def screen_z(height = 0)
        return 999 if @always_on_top
        z = (@real_y - self.map.display_y + 3) / 4 + 32
        if @tile_id>0
          return z + self.map.priorities[@tile_id] * 32
        end
        if self==$game_player
          return z + 32 if @direction==2
        end
        # Add z if height exceeds 32
        return z + ((height>32) ? 31 : 0)
      end

    2G8aLip.png


    eeJ76iD.png


    Thanks!
     
    Back
    Top