Prototypes: Introducing Floating Custom

The 2nd prototype is yet to be finished as the artwork is still being done for it, so I dived into starting the next prototype introducing the floating custom. Probably a good time to do so as we both still have a lot to do. Yikes.

This next section of Isiko is another introductory level, meaning the mechanics and interactions for it will still be simple enough for the player to understand how the next custom works without getting too frustrated with the game. The previous level had the rock starting the chain of events, but after having a chat with Syl, we decided that the custom will trigger the event as it will be easier for me to create and will be more interactive. My work for this section can be found on pages 14-20 of my sketchbook.

In this scene the game will be introducing a pulley system for the villager to get back to his hut. After which he can open the gate for you to finish the level. The custom will cause a boulder to move down the scene and move the pulley system, working similarly to the previous level so the player will have the knowledge of what to do. The image below shows the final layout of the scene:

level3.jpg

The next step was changing the code for the new custom. I already had the scripting and scene set-ups for the custom triggers, so I just moved those around in the scene to new positions. Shown below:

Screen Shot 2018-03-26 at 15.26.06.png

As this custom will be floating upwards I had to change the transform point where the custom will move to when the player presses triangle on the controller. I put them slightly above Isiko so there would be no contact between the two game objects and made small amendments to the code for it to be the floating custom. As I want it to interact with other game objects I had to leave the rigid body on it and change the gravity scale to 0 so it could float up. I then added a simple Vector 2 velocity change in the y axis so it moved up the game scene. The code for this is shown below:

Screen Shot 2018-03-26 at 15.08.25

The next step was introducing the pulley system into the scene. I had yet worked on anything like this so went to the Unity API to see how I would go about doing it. I could have made the ropes that the pulley system used static and then simply moving them up and down but this would have made it look rather boring and unrealistic, so looked into how I could create a rope. I came across hinge joints in the manual which told me this allowed two rigid bodies to be connected together. So, I created an empty game object with a chain of blocks all attached to each other, creating a rope. For the pulley system to then work I worked out I could increase/decrease the size of the blocks using their local scales, moving one down and the other up. So, when the boulder connects with the pulley ‘cart’ one side will increase in size and the other decrease. My notes on this section can be found on pages 31-37 of my ‘coding’ book. The scripting and a video of this test can be found below:

Screen Shot 2018-03-26 at 15.08.42

For the pulley system to return up the scene, I created a separate method that was a reverse of the original, and used a timer to tell the engine when to return the carts to their original position. After the villager returns to his house he will open the gate for Isiko and the level will be complete.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s