Wednesday 4 March 2020

Unity Tutorial 06

We are now starting a new Unity Tutorial. This time the outcome of the game is that the player will be able to press spacebar and make the character jump, as obstacles spawn at the edge of the screen and block the player’s path. Then we will make the background move flawlessly at the same time as the obstacles, and the obstacles will de-spawn when they exit game boundaries. Then we will make it that the background and spawn manager will halt when the player collides with an obstacle. Colliding with an obstacle will also trigger a game over message in the console log, halting the background and the spawn manager. Lastly, we will code so that the character will have 3 new animations that occur in 3 different game states. These states include running, jumping, and death, all of which transition smoothly and are timed to suit the game.

Lesson 3.1 Jump Force:

This tutorial was simple, or so I thought. Although I was writing in my C# code correctly, in my gameplay the game itself was very glitchy and not working as it should be. My player did not jump in my game. I had checked the code and followed the video tutorials exactly, yet why is my player not doing what he is suppose to do? This was really frustrating but I kept going with the tutorial in hopes that something would change and it would make the character jump. My obstacle did move as suppose to (even though it was extremely glitchy). The spawning of the obstacles worked well and later on I found my mistake in why my character did not jump when space was pressed - "Is Kinematic" box in the RigidBody was ticked when it should not have been. So now, my character jumps and the obstacles spawn as shown in the tutorials.

Unity Tutorial 3.1

Lesson 3.2 Make the World Whiz By:

In this second tutorial, we made the background repeat itself while the character jumps over the obstacles, we added a 'Game Over' bool as well as making the objects stop spawning once the game is over. And then lastly, we coded so that any obstacle that exits bounds is destroyed. This tutorial worked a lot better for me as everything went smoothly and I got everything to work.

Unity Tutorial 3.2

Lesson 3.3 Don't Just Stand There:

Moving onto the last tutorial. This is where we adjusted the characters movements and make them look like they're moving. Before even starting the tutorials, I received a red error stating something in my C# script was incorrect. This I fixed as the )) brackets were not correctly written in (according to Visual Studio anyway) even though it was the same code - the orange colouring was different and it triggered the error. We used the animator component located in the player inspector to make the character run in time with the background, then used the player controller script to code so that the character would not run while jumping over the obstacles. Lastly, we edited the code so that the player isn't able to jump while the character is "dead" at Game Over.

Unity Tutorial 3.3

No comments:

Post a Comment