How do I stop an else if statement???

Get help using Construct 2

Post » Sun Feb 26, 2017 1:36 pm

ok, so i have gotten everything working so far except for 1 glitch....so after completing a level, other levels start to unlock them selves and not just the next level as it should be, after debugging a lot i have noticed that since i have a nested if statement, my score criteria is meeting other conditions
i.e if score > 1000 goto level 2
if score > 2000 goto level 3

and i score 2000, so first condition is met as well as 2nd,

any way i can stop an if statement?
http:// imgur.com/a/JJHVT
you will notice other conditions like currentlevel as i was trying to fix the issue but it still persists.
B
6
S
1
Posts: 17
Reputation: 386

Post » Sun Feb 26, 2017 3:00 pm

Right click, add new condition.
If score is > 1000
And
If score is < 2000
Do action


Or

Name layouts "level 1,2,3 ect"
On end of layout | system go to layout "level" & floor (score/1000)
Last edited by celstrider on Sun Feb 26, 2017 3:30 pm, edited 1 time in total.
B
25
S
16
G
26
Posts: 125
Reputation: 16,103

Post » Sun Feb 26, 2017 3:08 pm

Use Else.

if level <= 1 ...
Else if level <= 2 ...
Else if ...
ImageImageImage
B
71
S
22
G
248
Posts: 3,756
Reputation: 138,058

Post » Mon Feb 27, 2017 7:12 am

celstrider wrote:Right click, add new condition.
If score is > 1000
And
If score is < 2000
Do action


Or

Name layouts "level 1,2,3 ect"
On end of layout | system go to layout "level" & floor (score/1000)


hi, thanx but there are multiple condition that are met that's why the <1000 and >2000 wont work, creating level layout is like a last resort as i have 1 layout that im using for different levels, the conditions are what seperate the levels
B
6
S
1
Posts: 17
Reputation: 386

Post » Mon Feb 27, 2017 7:13 am

blackhornet wrote:Use Else.

if level <= 1 ...
Else if level <= 2 ...
Else if ...


i am using the if else but if i'm on the first level and i score 2000, level 4 gets unlocked as the score condition for level 4 is also met.
B
6
S
1
Posts: 17
Reputation: 386

Post » Mon Feb 27, 2017 10:03 am

Reverse the events and use else

score > 4000
______ got to level 4
Else
score > 3000
______ got to level 3
Else
score > 2000
______ got to level 2
Else
score > 1000
______ got to level 1

If 'score > 4000' then 'score > 1000' is also true, but it will not run.
'Else' runs only if the previous condition(s) did not run.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Feb 27, 2017 6:29 pm

Ok thanx but if you look at the screenshot, im actually checking the level firat then score, not only score but whether level is 1 or not, it finds highest score condition
B
6
S
1
Posts: 17
Reputation: 386

Post » Mon Feb 27, 2017 10:26 pm

Did you try this ?
blackhornet wrote:Use Else.

if level <= 1 ...
Else if level <= 2 ...
Else if ...


Put an 'else' in the blocks containing that 'Webstorage key ?" (except in the first one)
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Feb 28, 2017 9:21 am

99Instances2Go wrote:Did you try this ?
blackhornet wrote:Use Else.

if level <= 1 ...
Else if level <= 2 ...
Else if ...


Put an 'else' in the blocks containing that 'Webstorage key ?" (except in the first one)


hi, thanx a lot, only reading now thou i tried the exact same thing, seems to work but will test it more extensively.
B
6
S
1
Posts: 17
Reputation: 386

Post » Tue Feb 28, 2017 10:43 am

Message: mileycyrus847 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
i have tried it and it actually works!!! thanxx for sharing a great post!!!!
[url http://appapk.org/xmodgames/]download Xmodgames app[/url]
B
2
Posts: 1
Reputation: 152


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 45 guests