During todays session, we continued to work on our 2D platformer tutorial. The main exercises that were covered were adding an NPC that you could interact with to end the game, as well as a timer which would count down till a game over appeared.
These exercises both used audio very heavily, and we had to link several audio files to different elements, which did get a little difficult to keep track of at some points.
We also had to add several new objects, such as an NPC sprite, and dialogue that would appear when we collide with them, a GameOver text, as well as a counter for a time limit and a collectible counter.
To make these features work, we had to create three new C# scripts called "Level Complete", "TimeManager", and "CollectibleManager".
The level complete script was in charge of detecting the moment the player collides with the NPC, then showing the level complete text, stopping other sounds in the scene, playing the "Level complete" audio, then moving on to the next scene.
The "TimeManager" script was in charge of detecting the moment the timer runs out, showing the "Game Over" text, stopping the other sounds, playing the Game Over audio, then restarting the scene.
The "CollectibleManager" script was used to make sure the collectibles could be picked up and keep track of how many collectibles were being picked up by the player character.
A part of this session I found particularly helpful were the code examples that had been attached to the tutorial PowerPoint, as it gave me a good point of reference to what the code in my scripts were supposed to look like.
The "CollectibleManager" script didn't have an example file included in the PowerPoint, which intrinsically made this script more difficult to create than the other two.
There were some quite confusing parts to this exercise, mainly when it came to applying our scripts and sound files to different elements, and I did find myself getting mixed up a little bit. I was able to fix some of these problems by myself, but there were a few times I needed some assistance from the tutor.
As well as helping me with these issues, the tutor also helped me fix the weird lines that were present in between some of my tiles, which we did by going into the sprite editor for the tiles spritesheet and adjusting the sizes of some of the tiles to cut out the problematic parts. To make sure these cut tiles would fill the grid properly, we had to reduce the "size per pixels" from 16 to 14, which made some of the tiles that didn't get adjusted look a little weird due to making them all bigger. However, this was necessary in order to correct the larger problem.
In the afternoon, we were given some time to ourselves to work on what we wanted.
Some of this time I spent correcting a few elements of my platformer scene. There was only one issue I didn't quite fix, but I eventually decided to leave it alone, as it didn't really impede the function of the game and I was happy to move onto something else at this point in the day.
![]() |
This is what my document looked like by the end of the session |
Comments
Post a Comment