How do I make a back (undo) button?

Get help using Construct 2

Post » Mon Nov 21, 2016 6:07 pm

Hey guys I need help creating a button that when I click it it rolls back an question.
I tried lots of ways, using variables, sub-events and some other stuff, but since im using variables + button clicks, I cant figure out how to go back a step in my project.
Is there a way to make that button or do I need to change my events in any other way?


Thanks in advance
Posts: 23
Reputation: 555

Post » Mon Nov 21, 2016 8:09 pm

I would say that the simplest solution would be a dictionary.

You would do the following:
  • Add the "dictionary" object
  • At the start of the layout, add values to the dictionary. The keys are the number of the question, e.g. 1 for boy or girl.
    The values are THE EXACT names of the appropriate function.
    (For the boy-or-girl-question, it would be "key: 1, value: start")
  • Now, you add a variable, called for example "progress"
  • Each time, one question is being answered, you add 1 to "progress"
  • when the back-button is pressed, you call the function "Dictionary.Get(str(progress-1))"

That's it. If you need more help or a .capx, give me a shout.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
Posts: 528
Reputation: 7,091

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 5 guests