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?

.capx https://drive.google.com/open?id=0B29NMnCApa87VlBLS3lybldiaUk

Thanks in advance
B
8
S
2
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
B
27
S
11
G
8
Posts: 528
Reputation: 7,091


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests