Day 2 — User Input, Movement and Variables.
Although a little later than I wanted to post, Day 2 was a pretty exciting few hours. As I start to get more into the course, I plan on expanding upon everything I did before and more. I want to polish my skills, with using this as the start.
Day 2 is about variables, getting my player moving and the user input behind that. Variables: they are your “building” blocks so to say. They allow for you to “vary” said values. They are able to change as needed, when needed and however you design them to. There are several different types of variables that Unity and C# recognize. The main types that most people know are: Integer (int), Floating point number (float), Boolean (bool), and Strings (string). An integer is as you thought, a whole number. The floating point number is just a decimal, 5.5, is such an example. Boolean is a true — false statement and a String is what you see here, a single word or a line of text, that is usually denoted by quotation marks. All of these are variables and when made they do not have a fixed value. Though there are ways to get a variable to have a fixed or static value. The “static” keyword tells the scripts to put the variable into memory for easy access because it is as it says: Static. Unchanging. If you need a variable that shouldn’t change, make sure you add the static keyword.
Going into the next part of this was User Input and getting my player moving. Looking at the picture this is my Player Class.
This allowed for my player to move as I needed.
Going through this course again is going be fun. Documenting it will help me in multiple ways. Hopefully you enjoy the journey just as much as I will. On to the next part. Getting the laser shooting and some enemies implementing.