Unity 2d tutorial 3:how to animate move the player in platform 2d game unity engine with easy c# codings


In this tutorial We want to see how to animation moving character(player) in a 2d platform game on unity engine with easy c# scripts.This tutorial we can learn step by step process to move the  character(player)  in 2d game.I wish you can learn this easily.I will explain with screenshots and videos.Lets go to tutorial.Its not much harder




Before enter this tutorial you want see these tutorials 

  •  How to move player here.
  •  Flip the player tutorial here.




1.You know how to move and flip the player.now i am going to tell you to how to animate the player while moving.



2.click the player in the hierarchy



3.in the animation tab click create and save as idle




Unity 2d tutorial 3:how to animate move the player in platform 2d game unity engine with easy c# codings
4.click the down arrow in the animation tab and click the "create new clip"  and save it as run


Unity 2d tutorial 3:how to animate move the player in platform 2d game unity engine with easy c# codings


5.drag all running images to the run script (download here{you want to slice the runinng image watch video here})


Unity 2d tutorial 3:how to animate move the player in platform 2d game unity engine with easy c# codings


6.make your you enable the show sample rate



7.adjest the value of sample to adjest the speed



8.now go to animater tab

Unity 2d tutorial 3:how to animate move the player in platform 2d game unity engine with easy c# codings



9.make transection each other to run and idle by right clicking and clicking the make transection

Unity 2d tutorial 3:how to animate move the player in platform 2d game unity engine with easy c# codings



10.now click the plus simbol in the parameter and click bool and name it as isrun

Unity 2d tutorial 3:how to animate move the player in platform 2d game unity engine with easy c# codings



11.now click each trasection and do following

off exit time
untick fixed duration
make trascetion duration to zero
Unity 2d tutorial 3:how to animate move the player in platform 2d game unity engine with easy c# codings



12.add each contition to each transection arrow

idle to run arrow -make contition as isrun true
run  to idle arrow -make contition as isrun false

Unity 2d tutorial how to animate move the player in platform 2d game unity engine with easy c# codings


13.Ok now open the playercontroller.cs script and add those thing

  Create variable=> public bool isrun=fasle;
                                                Animater=anim;
                      
  In start mathord=> anim= GetComponent<Animator>();

  In the update methord=>  if (Input.GetAxis("Horizontal") != 0)
                                                               {isrun = true;}
                                                                else
                                                               { isrun = false;}
                                                               anim.SetBool("isrun", isrun);

14.then start the game.If any error comment me(download script)





Check it in this tutorial in this video,
 



If is it usefull and you want more videos subscribe my channel subcribe my youtube channnel



you can watch how to move player in this link here
you can watch how to flip moving player in this link here


Watch tutorial to download Unity Engine here