O'Reilly logo

Unity 2D Game Development by Dave Calabrese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Gotta move it!

Our player now has a basic idle animation, but we can't interact with him yet. Let's fix that. Here is where we add the ability for the player to move around the scene.

We are going to use the existing key bindings that are present by default in a Unity project. To see what these are or change them, navigate to Edit | Project Settings | Input and mess around. Unity stores all keybinds as axes, as they all have floating point values. This allows all input buttons for the engine to support the classic on/off function as well as support more touch-sensitive buttons and joysticks, such as those present on most modern gamepads.

Let's create a new folder in our project folder called Scripts, and inside that, create a new C# script. Call ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required