Search Unity

2D Animation Scripting

Discussion in 'Scripting' started by nitishk, Mar 23, 2013.

  1. nitishk

    nitishk

    Joined:
    Mar 23, 2013
    Posts:
    10
    I am currently working on a 2D platformer game. For animations I have attached a sprite sheet as a texture to a plane and I cycle through each sprite for animations like a walk cycle. The problem I am facing is how to run 2 animations at a time? For example, what if the player clicks attack and is holding the walk button at the same time. Since the walk has its own sprite sheet and the attack has its own do I need to make another sprite sheet in PS and in that sprite sheet both actions are being performed or is there a way to do this in unity itself?

    I would prefer not to use any external plugins for unity, mostly because of the cost but if there is a free one I would love to check it out so please recommend a good one you know.
     
  2. PavolM

    PavolM

    Joined:
    Sep 4, 2012
    Posts:
    37
    Hi :)

    If you are working on 2D platformer game make sure to check Walker Boys tutorial
    its called 2D Game Development - SideScroller - in HD here.
    He explain a lot of things you need to know.
    And you dont need to make more sprite sheet for walk, attack, jump, etc. animations just make one with all of this
    example :
    Remeber that there is size limit of sprite sheet i think for mobile devices its 4096px, not sure check on the internet.
    or make more sprite sheets and use variable to store texture sprite sheets and change which one is going to be rendered by script...
    Code (csharp):
    1. renderer.material.mainTexture = your_texture_variable;
     
    Last edited: Mar 23, 2013
unityunity