Following on from part 1, I then had to create a series of events that opened the gate at the far end of the level so the player can progress to the end. The sequence is as follows:
- Rock is thrown at tree
- Bird is disturbed by the feeling/noise and flies to the gatekeeper’s roof
- The bird begins to peck at the gate keeper
- The gate keeper comes out of his house to notice Isiko there and opens up the gate
The finished version will have the animations of the the gate keeper coming out of his house, him pulling the lever and the bird flying around but for now I have used a bird sprite and colour blocks to simulate the rest of the prototype. The colour for these are as follows:
- Brown = Tree/House
- Blue = Gate
The first job for this was getting the the bird to move once the rock had hit the tree. I originally asked Syl if this could just be an animation that played once the rock had hit the tree but due to having to resize in Unity it would be difficult for her to correctly complete the animation. So, we will have a static bird animation game object that will be moved via scripting. As the rock is the game object interacting with the tree, I created a script that was attached to it and referenced the gate and the bird in it so they could be manipulated in that same script.
I first created a reference to the bird and did some research on what scripting could move the bird. Having used the method MoveTowards last year, I gave myself a small recap on how it works and decided to use this for the method. I first set up my game scene, placing the bird sprite next to the tree and creating an ‘end position’ where the bird would finish its journey on top of the house. The image below shows the bird and the ‘end position’.
To make this scripting easier, I create several bools to ask the game whether or not the bird and the gate can be moved during the event triggers. For the events to occur I first used collision detection when the rock hits the tree, if it hits, the bool for the moving the bird is set to true and therefore it can then move. The method for moving the bird and calling it in the update can be found below:
This method first references the bird’s position, then moves the bird, the start position being where it currently is, the end position being the ‘endPosition’ game object, moving at a speed which is registered in the start method of the script.
This asks if the bird can move, if so, the method to move the bird activates and moves the sprite.
The next step was to move the gate, which will use a similar method to moving the bird but will not recover a specific point to move to as a gate can only move in the Y axis. So, as the bird’s final position is the ‘endPosition’ game object, the update method asks whether the bird’s position is equal to it, and if it is, the gate is moved upwards at a uni per second. The scripting for this can be found below:
A YouTube clip of the introduction working can be found below:
Despite me knowing how the introduction is played and how it works, I needed a third party to play it and essentially break it so I know where the game can go wrong and how I can fix it. I asked two second years to play it for me, gave them the controls and an objective and said nothing else. The full notes of the testing can be found in my ‘feedback’ folder. But the two main problems were the rock being moved by the square button before being picked up and the players jumping onto the branches where they are unable to get out from. So, I head back into the scene to fix these.
The first problem was a small fix, I added a second statement along with the square button being pressed asking if the rock had been grabbed by the player. So, the method can only be active if both statements are met. The code for this is shown below:
The second fix would require a change to the layout of the map. As the branches are the same colour as the platform, the scene suggests that the player has to move off of the platform onto the branches in order to do something, despite this not being the case. So, after a talk with Adam, he suggest I change the platform in order for the player to better understand the situation. So, I added a barrier stopping the player from being able to jump off, suggesting to the player that something has to be thrown off of it instead of them moving up it. The final platforms are shown below:
I then asked two more people to play the prototype, both took a little time to figure out what to do, which will probably change once artwork is added to it. But, neither play-throughs required the game to be reset which means it is fully working. Now this is complete I can work on the next prototype that will introduce the customs into the game.