[go to layout] causing application to close

For questions about using Classic.

Post » Sun May 19, 2013 12:14 am

so I have four buttons on the second layout of my project set to all add a certain value to a variable, and then go to a different layout. The problem is that when I press any of these my application closes out rather than go to the layout.

https://docs.google.com/file/d/0B0gf0yi2MHX3MFJWX1ZaYWVpclU/edit?usp=sharing
B
5
S
1
G
1
Posts: 27
Reputation: 679

Post » Sun May 19, 2013 10:39 pm

Ah since you're referencing them by name instead of their number you should put " marks around them, eg: "c1". Otherwise you can reference their layout number exactly (c1 would be layout 3 I think, unless it's 0-based then it would be 2).

Going by name lets you do things like: Go to layout -> "Level" & (global('LevelNum') + 1)

Edit, as a further example you can also bring randomness into it: Go to layout -> "Level" & clamp(random(3) + 5, 5, 8)

This would go to a level between Level5 and Level8

Hope that helps!

Double Edit: Oops, did the math in my head wrong, this would only spit out Level5 to Level7, thanks Tulamide! Jayjay2013-06-08 00:34:58
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Tue May 21, 2013 3:17 am

thankyou, this helps alot!
B
5
S
1
G
1
Posts: 27
Reputation: 679

Post » Tue May 21, 2013 4:35 am

Anytime!
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Wed Jun 05, 2013 12:22 pm

I have similar problem. I shared my game world into some sections to increase performence. In C2 i can see all of my lauouts, and by going to project folder, i see them in layouts folder (nice xml files). But where they are in html/exported mode?
I noticed, there are some references to layouts look in c2runtime.js, but still I'm not sure - is that the place where all informations about layouts are stored ? If so, what is the purpose of two xml's in my cocoon-export folder ? Is it C2 garbage, or something ?
B
22
S
3
G
2
Posts: 30
Reputation: 3,688

Post » Thu Jun 06, 2013 4:02 pm

@stachir ah this is for Construct Classic. Best place to ask for C2 is in this forum: https://www.scirra.com/forum/how-do-i_forum45.html
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu Jun 06, 2013 11:40 pm

Sooo you say, I should first choose right category, and then write some stuff about my invalid problems ?
...
holy mackerel ;/

ok, sorry for inattention ;]
B
22
S
3
G
2
Posts: 30
Reputation: 3,688

Post » Fri Jun 07, 2013 12:58 am

Heh no problem @stachir
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Fri Jun 07, 2013 9:36 pm

I know I should stay out of it, but since it is important and I am kind of a nitpicker who sometimes cares for examples being correct:

[QUOTE=Jayjay]Edit, as a further example you can also bring randomness into it: Go to layout -> "Level" & clamp(random(3) + 5, 5, 8)

This would go to a level between Level5 and Level8[/QUOTE] No, it wouldn't. It would go to a level between "Level5" and "Level7". Also, clamp() isn't neccessary. The number range is already clamped through the use of random()
random(3) spits out one integer of 0, 1 or 2. In general, random(i) => [0, i-1]
random(3.0) on the other hand spits out any float >0.0 and <3.0 (e.g. 0.000001, 1.27 or 2.99999)

I apologize for being meticulous, but it makes a difference.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Jun 08, 2013 12:34 am

@Tulamide, ah I found random doesn't spit out nice integers for me like I try to force it into, although the clamp wouldn't solve that either.

And surprised to see random(3) is between 0 and 2, thanks for sharing

"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests