Today I learned more about variables and grasped a basic understanding of how variables work. I learned that there is 4 data types, booleans, integers, floats, and strings. Booleans are true or false, and applied to games they could work as inventory or event commands. Integers are whole numbers, and applied to games they could work for health gauges. Floats are decimal numbers, and applied to games they could be used for positioning and scaling or maybe damage reductions. Strings are used for text, and can be used to store names or subtitles. To make a variable, you declare the data type, followed by the name and then a semicolon.
Access modifiers are added to variables so that you can access that information from anywhere. In Unity, you can add ‘public’ to the start of a variable to allow the data to be changed from the inspector inside Unity.
I then applied this to my spaceship game to add engine power and allow the ship to thrust forwards and backwards, and to allow it to rotate.