give each button their own unique value stored in the objects instance variable.
buttonA value 1, buttonB value 2 etc.
Then each time a button is pressed add this value to a global text variable.
So it would look like "1,2,1,1," etc depending on the order of clicks.
Have another global text variable with the correct code stored in it to unlock door, then compare the stored text to the code after each click.
If they match the order was correct so open door. If the the number of tokens in the stored text (separated by the comma) is equal or greater then the code text but they dont match then the order was incorrect.