The key to the game


One of the biggest challenges for me was working out how to make the door animation work in conjunction with a key.

i.e. define the door as locked and define the key as a means of unlocking.

With support from Dan Beaumont at the AIE we were able to solve this problem:

We used 3 scripts to define the rules and you can see them in the attached images. 

In essence we defined a boolean to dictate in the inspector if a door is locked

Another boolean declared whether or not the player is holding the key (keypickup script). This in turn effected the character health script which would ultimately run the animation if all applicable rules were met.

This represented my first full understanding of how to effectively use if/else statements.

Leave a comment

Log in with itch.io to leave a comment.