Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

how you make the tranistion between run and idle? thanks

Hi, something following this logic (I change the animation by code):

public string currentAnim = ""; 
public bool ruuning = false;
public Animator animator;
 
public void ChangeAnim()  
{     
    // The default animation     
    string newAnim = "Idle";    
      
    // Check if the char is running (maybe check velocity.x != 0)     
    if (running) newAnim = "Run";
          
    // If the char was running and now it's not      
    // then it's going back to Idle     
    if (currentAnim == "Run" && newAnim == "Idle")          
        newAnim = "BreakRun"; 
         
    // If the new animation differs from the current one plays it     
    if (newAnim != currentAnim)          
        animator.Play(newAnim);
          
    // Set the current animation with the value of new animation    
    currentAnim = newAnim; 
}

wow thanks