getting a door to open after a puzzle has been completed

I was just wondering if there is a way to make a door open after a puzzle has been completed. In this case a set of 4 levers being pulled in the correct order.

This is totally possible. How it is implemented, though, is completely wide open. You can do this in any number of ways. If you're not sure about ideas, here's one way you could do it:

  • Store a list with the order of the levers.
  • Store an integer with how many levers have been pulled.

If the user pulls a lever, check the current lever being pulled against the list of levers to see whether it was the right one. If it isn't, reset the levers and the integer of how many levers have been pulled. If it is, increment the integer. When all levers have been pulled, execute the door opening script.

Now go write it!

Your gonna wanna do something like this:

Declare a variable called “openDoor”

Make it a boolean (using “: boolean” if you didnt know

Make it = false

You should have something like this: var openDoor : boolean = false;

Now you want so if the levers are pulled in the correct order than it will execute a block of code

You want that block of code to contain this (if you used openDoor for your variable name):
openDoor = true;

In your update function write this (if you used openDoor var name):

if(openDoor == true) {
//put your code you want executed when the levers are al pulled in order in here:

Thats it! Good Luck with your game! Sounds like it will be fun!