Thursday, October 1, 2015

Unity Day 14 (Space Shooter Project)

What I Did:

     Today I begun by creating a new game object and naming it Asteroid. I then went to the models folder and dragged the first asteroid model onto the new asteroid game object making the model a parent of it. I added a rigidbody and capsule collider component to the asteroid game object and re sized the collider to properly fit the asteroids model. I then added a script to make the asteroid tumble at random with a simple code and also added another script that made the asteroid destroy itself and the laser fire upon contact. There was a bug that made the asteroid destroy the boundary object on the first frame, however this was solved by adding a tag to the boundary and telling the code to ignore the collider on the boundary.

Tumble Code:



Destroying Code:


     Moving on to the next tutorial, I will be adding explosions to the game. I added two bits of code that allowed me to drag the asteroid explosion and player ship explosion animation onto the variable slots, and made it so it played the asteroid explosion upon contact with the laser and both explosion upon contact with the player ship.



What I Learned:

     I learned how to add hazardous types of objects, how to call an animation upon specified circumstances and how to make an object tumble at random.

What I'm Doing Next Day:

     Next day I will be adding a game controller to control how the game operates, such as spawning waves of enemies and hazards.


No comments:

Post a Comment