For the next several weeks, my focus is going to be getting a basic 2D game going. In this, I'm taking inspiration from games like Galaga and Space Invaders.

While this is going to appear as a 2D game I'll actually be working with a 3D foundation. First I'd like to get a character to play as, with movement from player input.

To start, I'm creating a cube to represent my player, creating a player material, and applying the material to my game object. These are concepts from my first day of working in Unity.

None

Next I'm going to adjust the camera settings. I don't need the Skybox background, and would actually like this to be solid for the moment to focus on getting my player set up.

These settings are found under the Environment setting in the Main Camera. I've set the background to a solid black, and now my player stands out like I was looking for.

None

Next I'm going to create a new MonoBehaviour script called Player. This script will allow me to set rules for how my Player object interacts with the game.

None

There are a number of things I want to define at the beginning. Where does my player start the game at? How do I move my character?

Addressing the first point, when I start the game I want to start in the center of the game. We will do this by assigning a new value to the transform component. Here I assign a new position to the player in the Start method.

None

The transform component's position values are stored in a Vector3 datatype.

Next I want the player to move. To do this, I'll be using the Translate method of the transform class. In the Update method I'm going to put a line to move my character to the right.

None

I'm using the calculation to help the Translate move at a speed that's more in line with what I would expect. The Update method is called once per second. Calling Vector3.right would move my character 1 unit per frame, which usually corresponds to about 60 frames per second. Time.deltaTime helps to translate that frame rate difference to something closer to real time, like 1 frame per second.

None