Unity: Lesson 8 (Need to add images)
To continue on with the platformer game and to learn a few more game aspects:
We created a level complete NPC with a is trigger collider. We then added audio which would play when the level is completed. We then added the script which would check if it is the player which interacted with the collider (with the player tag), shows the npc's level complete dialogue, stops the background music, plays the level complete audio and loads the next scene in 3 seconds using invoke. This script uses the scene manager so we had to remember to add it at the top. We also needed to check that the new scenes were added in the build settings. One of my scenes kept reseting so I just used one of the ruby's adventure scenes. We then added references to the script and tested it. When testing it didn't work for me at first because I mistook tag for layer so my character was part of the player layer but it wasn't tagged player.
We then went on to add a timer to the game which would count down and end the game when it is run out. We first added a game over ui which would show when the time runs out. We then added audio and the timer script. We also had a bit of a look at headers and tool tips for the script settings. We then also had a go at adding a ui which would count how many collectables the player has picked up. I did this in a way which was similar to the health collectables, but there was also a way to do it within the player using tags.
After this I went on to set up the sprite I made so that it was animated. To do this I first added the sprite sheet as a sprite and sliced it into the correct amount of sections. I then animated all the different animations I wanted. I then copied the blend tree from ruby and edited it to use my sprites animations. I also added a new blend tree for when the sprite is sitting and I scripted the sprite to sit after it has been idle for a while. With an older version of the ruby controller being in the sprites script I could then test the animations, however I forgot to tick the root part box so it was not moving. Overall I was really happy with how the animations turned out, though I probably need to test them a bit more and adjust the speed a little. I used a 6 sample size for the 4 frame animations and 3 for the others.
Comments
Post a Comment