playMaker

Author Topic: Simple Puzzle Button Sequence  (Read 1941 times)

grey_x0

  • Playmaker Newbie
  • *
  • Posts: 2
Simple Puzzle Button Sequence
« on: December 26, 2022, 08:01:58 AM »
Hello! I recently started going to a game school to become a game designer and I am currently making my first game/project with Playmaker. Everything so far was going smoothly but I recently became stuck trying to make a simple button sequence for a puzzle. What I want to make is this: there are 3 colored buttons on a wall (gameobjects) and you have to press them in the correct order (in this case imagine 1 is blue, 2 is red and 3 is green, the correct combination would be 3,2,1 for example) to open a door. I managed to set up the buttons that when you click on them (first person) with the mouse, they activate but I can't find the action required for them to send a signal to a fourth object, which would check if the order is correct and then open the door. If it is incorrect it should also reset the whole thing so that you can try again. I know I probably have to use arrays or bools but I don't know which and how to set it up probably. If anyone can help me I would be forever grateful cause I haven't found any decent tutorials anywhere...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Simple Puzzle Button Sequence
« Reply #1 on: December 27, 2022, 01:12:05 AM »
Hi.
This video might help :


When a button is clicked send a event (Button/1 or Button/2 or Button/3)
on the listener fsm have an array with the sequence.
An array starts @ 0 not 1, so index 0 would be 3, index 1 would be 2 and index 2 would be 1 (from your example)

When the event was send (for example Button 3) get the variable ("Array Get" action) @ index 0 (use a variable for the index)

Then compare if the same.
If the same :
Add 1 to the index (and you can do a success sound or something)
Then You can get the 'Array Length' and compare to the index and if equal, then you can do a completed event.
You could also just compare to value 3, but when using 'Array Length' you can easily change to bigger combinations (for example 3,2,3,1,3,1)

If not the same :
Set index Value to 0, send a event to the buttons to reset and optional do a fail sound/animation.

grey_x0

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Simple Puzzle Button Sequence
« Reply #2 on: December 28, 2022, 11:39:51 AM »
Thank you so so much, this really helps me a lot :')
Loving this community so far, I hope in the future I'll be able to help someone like you just did :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Simple Puzzle Button Sequence
« Reply #3 on: December 29, 2022, 01:20:17 AM »
Hi.
You should join our discord channel :)