How do I use instance variables to load layouts

Get help using Construct 2

Post » Wed Apr 23, 2014 6:02 pm

Hey all,

I'm trying to define a relationship between a "Go to layout" action and instance variables.

For example, each door in a room has an instance variable of Exit with values 2-5.

When the player sprite collides with door 3, I want to load the layout called "3".

I've tried using

On collision with Sprite / System / Go to layout "Sprite.Exit"

But it doesn't seem to be working.

What did I miss?

Help!

Thanks in advance
B
8
S
2
Posts: 11
Reputation: 734

Post » Wed Apr 23, 2014 6:05 pm

It's a bit of a guess - it might require a string variable. Either Go to layout (by name) = str(Sprite.Exit) or even ""&Sprite.Exit.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Thu Apr 24, 2014 6:46 pm

You are a superstar hero!

str(Sprite.Exit) worked like a charm.

:lol:
B
8
S
2
Posts: 11
Reputation: 734


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests