Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

8-way 2D Animations with Equipment System.

Discussion in '2D' started by Whoaa, Aug 28, 2017.

  1. Whoaa

    Whoaa

    Joined:
    Apr 21, 2015
    Posts:
    8
    Hello friends.

    Nowadays I'm working on a 2D isometric game. I have layer-order issues. Normally I have 8-way directions movement system like every isometric games. My character and equippable items (potions, weapons, clothes etc) have 8-way directions specific different animations.

    Please check 36-40th. seconds on video below. There is an character which has clothes and a weapon. This is 8-way direction movement on 2D. When he moves up-side, weapon hides normally. When he moves down-side or right-left side, weapon appears. This is all about sorting-layers on sprite renderer component, right?

    Video Content.


    So I have tons of items and clothes. I want to make that mechanism to my game. Should I handle all of different combinations and possibilities on animations when character moves to any direction? It sound terrible idea and probabbly too hard to work on this. So what is the tricks on that mechanics? How can I handle sprite render orders when he equipped seperate object?
     
  2. BowlerBitesLane

    BowlerBitesLane

    Joined:
    Mar 23, 2014
    Posts:
    4
    You can set the sorting layer of your character and all of it's child gameobjects through animations. I would recommend creating states for each direction that the player could walk, and then set the sorting-layer as appropriate for each direction. that way all you have to manage is which state you have transitioned to and the state machine will handle the various sorting layers. For different weapons you would just swap the sprite on the object.
     
    Whoaa likes this.
  3. Whoaa

    Whoaa

    Joined:
    Apr 21, 2015
    Posts:
    8
    Allright, I just thought that scenerio in the worst case. I already handle my character body animations. Meanwhile I should also change the sprite orders depends on animation directions right?

    By the way, I have another question. I have a character which has tons of animations like idle, walk, attack, run, die etc. I also have seperated items that have same animations like my character. For example, Bow_Idle_South, Bow_Run_Right and so on... How can I manage all those animations with just 1 animator? Its totally non sense to make new animator controller for every single item.