How do I set a dynamic page layout variable?

Get help using Construct 2

Post » Tue Mar 01, 2016 12:01 am

In the comments section of this tut @Kyatric posted a really simple "switch to layout" capx using an instance variable which works a treat.

As you can see, you set a static variable "PageToGo" per instance as follows:

Image

Simple, easy to understand and effective. Great for simple page-turning buttons :)

What I want to achieve is a little more complicated, that is, to have a single Layout which serves as a bridge been any two layouts. When a layout has been completed it automatically moves on to the "bridge" layout which stops until you press "go to next level".

So... on this "bridge Layout", how do I set "PageToGo" as a dynamic variable based on the last layout completed? I know it must be possible, but it's the syntax that escapes me. As I understand it:

  1. the instance variable shown in the clip above doesn't accept expressions
  2. I can't use "Go to next/previous layout" because that will always be the layout after/before the "bridge" layout
Many thanks in advance for your help! :)

"To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment."

Ralph Waldo Emerson
B
10
S
2
G
1
Posts: 56
Reputation: 1,300

Post » Tue Mar 01, 2016 12:10 am

You'd use "Go to layout (by name)". Just build up the layout name as a string: Goto "Page"&PageToGo
ImageImageImage
B
71
S
22
G
247
Posts: 3,756
Reputation: 137,558

Post » Tue Mar 01, 2016 1:17 am

OK, I'll try that now, thanks!

Edit: done that and it works a treat! Thank you!!

"To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment."

Ralph Waldo Emerson
B
10
S
2
G
1
Posts: 56
Reputation: 1,300


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 49 guests