I've been trying to use Go to layout(by name) for quite a while and I have not been able to get it to work.
I have a layout called "2". When the player reaches the end of level 1 the global variable CurrLevel is set to the integer 2.
Then in the Go to layout(by name) field I've tried:
"" & CurrLevel
None of these work. I know the code itself is executing because it works fine when I just use Go to layout and select from the drop down.
Any help on this small issue?
What happens when you execute that? The layout just stays at level 1?
It could be an issue with your global variable not being changed for some reason. If you can share the capx I can look into it.
Here is the .capx dl.dropbox.com/u/54560475/issues.capx
The problem area is at the end of the Game Event Sheet.
Thank you so much. <img src="smileys/smiley1.gif" border="0" align="middle" />
I got it.
First, remove the bottom event that you say is causing the problem. It's easier for me to explain this from scratch:
Player->On collision with Dimentionator->Add 1 to CurrLevel, Save game to mysave
(on a separate event, not sub event) System->On save complete->Go to layout str(CurrLevel)
=== That's it ===
"Trigger" condition, that is, the ones with the small green arrow on the event icons, cannot be used twice in an event block, including sub events.
"Is overlapping" will continuously append 1 onto CurrLevel, and "Trigger Once" can't stop it.
Ideally "On collision with" should be used instead of "overlapping", but because "on save complete" is a trigger in itself, "On collision with" isn't available as an option and "overlapping" just won't stop adding onto CurrLevel. The solution above will work.
Develop games in your browser. Powerful, performant & highly capable.
Awesome thank you so much!