Now that I have the introduction to the game tested and working properly in sprite build, it is time to move onto generating more ideas and then prototypes for the next stage. As you will have read in my previous posts, following the game’s introduction, the customs will be introduced individually in a puzzle format that abide by the game rules. So, the first one to be introduced is the counterweight and the player must complete a puzzle using it to progress through the game.
Having spent a lot of time recently on designing the puzzles for the game, generating ideas for this section came more naturally and readily to me. So, I was able to start prototyping in Unity a lot quicker than before. This gave me a lot of confidence moving forward into the next stages of development.
The ideas for this prototype can be found in my ‘Ideas Generation’ Folder in the section ‘Level 1’. For this I looked at previous studies of Rube Goldberg machines, also found in the beginning of my sketchbook, and noted down exactly what I needed for this section of the game. As this is still early sections of the game, it needs to be simple but still give the player an idea as to what will feature in the latter stages of the game. The prototype which I will be working with can be found in the image below:
For this next prototype, I simply moved and added to the previous scene I had built so I could get it up and running quicker than before. This section would again feature the rock throw, meaning I just needed to add a set up for putting down customs in different locations of the map. I started this with adding three transform positions and adding triggers next to these positions so the engine knows when a custom can be placed there. A screenshot of where these customs points are in the engine is shown below:
As I have not yet created an inventory system for the game, the custom put down will be simulated for this prototype. I started with placing the custom outside the visible scene and created a code that would allow it to be moved to the custom points. For this, I used the ‘OnTriggerStay’ method which means the custom can only be placed down if the player is within the box collider next to the custom points. I created three separate if statements in the update method for each custom point so the controls wouldn’t overlap each other. The code for this is shown below:
The next stage for this prototype was adding the movable platforms that the customs would interact with. I created these using the 2D hinge joints, features of the Unity engine. I duplicated the platforms, renamed them and added the joints to them so they can be moved with other game objects. I first tested the hinge joints by dropping the ‘rock’ game object down the scene and the bottom platform ended up spinning continuously. So, to fix this I added minimum and maximum angles it can rotate on. Shown below:
I now had half the scene set up but decided to come back to finishing it as Syl had sent me the animations for Isiko which I need to implement. In our year 2 project, animations gave me a lot of grief so I know I would have little trouble setting them up in this project. I used the same method as before, setting up the animator which is attached to the player and individually adding the animations into it. My notes on getting the animator working properly can be found on pages 12-20 of my coding sketchbook.
The image above is the animator tree for Isiko. He will begin every scene in an Idle state and then can walk left or right from this. At this stage, we do not yet have the animations for when Isiko turns around (transition between left and right walk). Having looked at Night in the Woods gameplay which features this transition, we decided it would be best to add one of our own for smoother gameplay. This feature will be added in at a later stage of development.
After walking left and right, Isiko can climb up and down ladders, meaning there had to be transitions between all 4 moving animations currently in the animator. I created bools for the transitions between these and created a new script named ‘IsikoAnimations’ to handle these transitions. One of the lines for this is shown below, and all other transitions are handled in this script.
I made sure all the transitions had the correct conditions and tested out the transitions between the animations. The movement along the X axis had no problems, but once Isiko climbed up the ladders there was a delay in the transition between them, making it look like Isiko was still walking whilst moving upwards. I fixed this by un-checking the ‘exit time’ box in the animation transitions. This meant once the conditions were met, the animation would change instantly and not on a delay. So, the animation tree was working fully and I will be able to add in the remaining animations with ease.