Unity – Spaceship firing & projectiles

Following a run through of last week’s research we were set to work looking at some code which Ant had made as an addition to the spaceship game we all made early on in the course.

Our take was to look at the code and do five things,

List all of the variables created

Explain the data type of each

List the functions declared

List the functions called

Explain the use of conditional

Literally no idea. Stared at the screen for 20 minutes. May as well have been written in Klingon. Loaded up a previous tutorial from very early on to find out/remind myself what a variable is. Immense relief when the class went through the answers and as ever, I didn’t look at Ant for fear of being asked.

So, what I got was;

Rotation Speed & Game Object

Game Object = any object can be stored, data type of degrees – float.

Shoot (), Rotate(), Update() [Functions have brackets after them where instructions are written.]

Instantiate = first function in Unity created an instance of something. i.e., Input.GetAxis

Firing of bullets when a certain key is pressed. Also makes firing happen in the direction the ship is facing.

Five is the only one I pretty much understood and I’m fairly sure I’ve gotten mixed up with the others. When Ant marks sees the blogs I’ll know.

We also had an explanation of what this code does with a visual description too.

Also increasing or decreasing the number of shots (lower image) and rotation speed (top image) obviously altered how to upper right ship fired, less shots to more shots.

Within our groups for the trio game, we also looked at more code for next lesson where more waypoints and line of sight code will be used – and as ever I’ll remain clueless and probably sit there and stress myself out.

Search

Search for:

Text Widget

This is a text widget, which allows you to add text or HTML to your sidebar. You can use them to display text, links, images, HTML, or a combination of these. Edit them in the Widget section of the Customizer.