Unity Tutorial 3
Unity Week 3
For this weeks unity tutorial, we had to create a short gameplay of a farmer and farm animals that move and throw food. To start off this task I first created a script for the player that could only move a certain distance on the Z axis so <-10 or >10. This kept the character in the player view so he didn't go off screen. I also created a launch projectile action, so the player can throw fruit at the animals shown in the coding below. Altogether I had four scripts for each role, the player, the animals, destroy and movement.
For the animals and the food(I chose the bone) I used the destroy script to make them dissapear out of the players game view so they wouldn't keep running on forever in the game adding the destroy script to all the animals even the bone too. I set the move forward script onto the animals so they'd run towards the player and set each with different speeds. I also set a SpawnManager script which was set to a button so when the animals ran out of players view you could hit the S key for them to respawn as many times. Overall this Unity tutorial was fun to do yet challenging.
Comments
Post a Comment