Unity, 2D vector

In Ants lesson everyone continued with what they did last week, which was a asteroid game, the things that we actually did in class was creating variables understanding them and then making our spaceship move and rotate with the following code:CODE, SPACESHIT.png

The first part of this code is just adding variables which were for the most part floats which are decimals. In the code the variables aren’t decimals but we do still need it to be a float as when the ship rotates and moves the variable will move into 3.4 for example, then the last chunk of code is using the variables to determine how fast the spaceship rotates and moves forward and backwards.

Time.deltaTime was use to have the code run in real time rather then every frame, this is because a frames are as often as the computer will allow meaning the speed of the ship could be insane.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s