Unity 2d tutorial 1:how to move the player in platform 2d game unity engine with easy c# coding



In this tutorial We want to see how to move 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




1.create new 2d project as you wish in unity 

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




2.import asset that you want by dragging them into the project section (like background,player image etc... you can download here)

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




3.first drag the player image into scene view and  resize it .then add component "rigidbody 2d" and "box collider" in the inspecter section

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

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

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

4.and also drag the background image and then change soring layer to -1 add component "edge collider " then make that at the ground  for player collided and be on the ground
Unity 2d tutorial how to move the player in platform 2d game unity engine with easy c# coding

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

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




5.then create a new c# script as "playercontrol"

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



6.In this script type this in the update methord,

=>transform.Translate(Input.GetAxis("Horizontal") * 5f * Time.deltaTime, 0, 0);
Unity 2d tutorial how to move the player in platform 2d game unity engine with easy c# coding



7.save this script.and drag that to the player.(download script here)

8.then start the game.If any error comment me


       Checkout it out this tutorial in this video

    



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



you can watch how to flip moving player in this video here

you can watch how to animate moving player in this video here

Next tutorial,
unity 2d tutorial-2:how to flip move the player in platform 2d game unity engine with easy c# codings


Watch tutorial to download Unity Engine here