patjnr.blogg.se

Unity 2d movement script download
Unity 2d movement script download








Create a new script, name it "CharacterController2D" and paste the code below inside it:ĬharacterController2D.cs using System.Collections.Assign your sprite to "player_sprite" and move it inside the "Player" Object.

unity 2d movement script download

Create another GameObject, call it "player_sprite" and add the Sprite Renderer component to it.Create a new GameObject and call it "Player".Open Scene with your 2D level (make sure the level sprites have 2D colliders attached, so the player won't fall through).The controller will be physics-based and will use a Rigidbody2D component. To make a 2D Platformer Character Controller in Unity, follow the steps below. 2D Platformer is a type of game where the player jumps between platforms, avoids obstacles, fights enemies, all of which is observed from a 2D side-view perspective.










Unity 2d movement script download