Thomas Doukinitsas
INTERACTIVITY: Rotating the Ship and making it Shoot

INTERACTIVITY: Rotating the Ship and making it Shoot

Today's lesson started with a refresher exercise to see if we remembered C# coding. We were asked to create a script with a variable that counts up every time a boolean is true, and when the variable reaches 5 a force is added to the cube's rigidbody component. The final script looks like this:


After that short exercise we started to continue our game project

We added a line of code to the PlayerController script to stop the player ship from moving out of the game screen

We then created a new class and moved four variables in to that. We then slightly updated the code to find the variables

After this we started working on getting the ship to rotate when it moves. to do this we created a tilt variable, and then linked it to the ship's rotation.

To actually make it work this line was changes

The ship now rotates when it moves left or right!

Now it's time to make the ship shoot. We created a quad and added it to an empty game object that will store the code. Then we created a new material and added a texture to it.

To remove the black edge we changed the shader to a Additive Particle. We also added a rigidbody component to the "Bolt" empty gameobject to run the code

Also we added a cylindrical colider and shaped it to roughly fit the texture

Unknown

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard.

0 comments: