0 Favourites

# Make a Code (For a puzzle)

• 3 posts
• I am making an atmospheric platformer game and on one one stage I have 4 paintings set up in order (Mona Lisa, The Scream, Last Supper, and Starry Night) I want the player to jump on the buttons under the paintings in a certain order to get past the level.

Example, the player has to press The Mona Lisa, then Last Supper, Starry Night, and lastly, The Scream. (Then the key appears to go past the level) But if the player presses them in the wrong order, a light will flash red, signifying to start over and therefore resetting the inputs of the buttons.

I have thought and tried countless times but have not found a solution. Please try to give me an idea on how to do this. Sorry if I am confusing, Tell me to clarify and I'll try my best :)

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• If I were doing it, I'd create a global variable called sequence.

I'd give each painting's button it's own instance variable called

number, and assign them a number 1 through 4. (Mona -> 1, Supper -> 2, etc...)

I'd wrap the following in a group:

When a player jumps on a button, I would append the number of the button to the sequence variable. (i.e. they jumped on the Mona Lisa's button, so I would do System: Set Sequence to Sequence & Button.number)

Then, I would check to see if the sequence was not empty (sequence <> ""), I would then check if the sequence equaled the correct sequence to unlock the level. (sequence = "1324") If it does, do your unlock and turn this group off so it doesn't accidental trigger again if they jump on the buttons.

If it doesn't equal the full sequence, I would then check to see if it equals something other than the correct partial sequences (sequence != "1" and sequence != "13" and sequence != "132"). If it doesn't equal one of those, I'd turn on the red light and clear the current sequence.

Basically:

<img src="http://www.infinitepossibilitygames.com/demos/sequence/sequence.png" border="0" />

• Thanks for your help! I've not tried it yet but it looks promising. I honestly could not have thought about that as I am a beginner at this. Thanks again! (I'll tell you if there is a problem or it doesn't work)

• 3 posts