This is part 3 of a series of tutorials for Buiding a 2D Platform Game in Unity.
A character which can jump and double-jump is great, but we need a little more action. In this tutorial, our actor is going to be able to also move left and right. This tutorial shows how to use GetKey to handle the left and right arrow keys for movement. Then we add a function to flip the sprite horizontally, so it appears to face in the expected direction.
In this video we…
- add left/right movement with arrow keys
- use GetKey
- use GetComponent(RigidBody2D)
- use Vector3
- add a function to handle sprite flipping, horizontally
C# (C-Sharp) version
- See this link about the 2 Platformer GitHub source and tags
In the next video, I will show how to follow the actor with the camera, and detect death falls.
Be sure to subscribe to the Playlist to get the future updates: Unity 5 2D Platform Game Development (Mac) Playlist