Tuesday, September 29, 2015

Unity Day 12 (Space Shooter Project)

What I Did:

     I wrapped up the movement tutorial by setting the boundaries with variables named xMin, xMax, zMin, zMax. These where set under a class so they where more organized in the inspector. I set the values so the ship would always remain on the screen, and that there was some room near the top of the screen for obstacles. I also added a variable to add tilt to the player ship when moving along the x axis. To do this I added a variable called tilt and and added the line of code,

rig.rotation = Quaternion.Euler (0.0f, 0.0f, rig.velocity.x * -tilt);

and set the tilt value to 4. Now the ship tilts when it moves left and right.

     Moving on to the next tutorial I will be creating the shots for the player ship to shoot. To start this off I created a new empty game object and named it bolt. I then created a quad and made it a child object to the empty one. I created a new material under the materials folder and dragged the fx_bolt_orange texture from the texture folder onto the materials texture setting. I then dragged the newly created material onto the quad. The bolt was on the quad but the rest was black so I then needed to change the shader so that black was shown at 0 and white was a 250. I also added a cylinder collider and deleted the old mesh one. After i resized the mesh collider I dragged the bolt object to the prefabs folder making it a prefab. I then added a rigidbody component and a script to the bolt game object and coded in a variable that makes the bolt move forward.



What I learned:

      I learned how to create a bolt like texture and fade away unwanted colours such as a black background.

What I'm Doing Next Day:

     Next Day I will be adding code to make the ship shoot these bolts.

No comments:

Post a Comment