Level Select Question

Get help using Construct 2

Post » Wed Jan 29, 2014 4:19 pm

guys sorry for the trouble but i've been having trouble with my level select been trying out lots of level select here in the forum but to no avail i failed.. i am almost there but i got some problems whenever a finish a level sometimes i open 2 levels above instead of only one.. can someone please help me, been trying to solve this issue for almost a month

my game is like angry birds and my level select + star system is also alike from angry birds..

the bug that i have is

1.) when i finish a level and back to level select i unlock 2 levels ahead of me and i don't know at what instance it will happen it is random.

here is my capx just remove the . on the start thanks for the help in advance


.https://www.dropbox.com/sh/u6d361unvegv4qy/H_FWklRDWOGamers2014-01-29 16:56:36
B
1
Posts: 4
Reputation: 138

Post » Wed Jan 29, 2014 4:26 pm

Without seeing the capx I think it would only be guess work - not that that has ever stopped me before !
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Wed Jan 29, 2014 4:30 pm

Oh what the heck.

Do you have something like LevelUpgrade=0

I have done well so let LevelUpgrade=LevelUpgrade+1

LevelFinished so Level=level+LevelUpgrade

? If so look at where you set these doing the leveUpgrade twice

(total guess)

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Wed Jan 29, 2014 4:41 pm

i edited my post i post my capx with . on the start just remove it you can download it thanks

i dont have levelupgrade but i have currentlevel = 0
then after i finish a level

add 1 to currentlevel
Gamers2014-01-29 16:58:09
B
1
Posts: 4
Reputation: 138

Post » Wed Jan 29, 2014 6:37 pm

What I tend to do is on each level I have a sprite that holds level information in instance variables. Like CurrentLevel, NextLevel, etc... at the end of the layout I read these variables and use them for level unlock, score, etc... makes it easy and since the sprite has the same name on each level, I only need one event to read it in my end of layout event.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,573

Post » Thu Jan 30, 2014 4:34 pm

blue ill try that.. thanks but can u explain a little more..

like if i put an instance variable then should i delete my for example currentlevel global variable?

B
1
Posts: 4
Reputation: 138

Post » Thu Jan 30, 2014 5:41 pm

You can keep your globals if you want, just copy the value from the instance variable into it when the layout starts.

I have an invisible object called LevelGoal at the end of each layout. When the player touches it, I have a condition that reads the instance variables from it. I also have global variables for the high score for each level, the number of gems for each level and if the level was beaten.

When the user touches(collides with) the LevelGoal sprite, I check to see if the current level score is greater than the current levels score and if so I copy it into the global variable to replace the old high score. I also Set the Variable for if the level was beaten to yes. This is important because in my game a level can only be unlocked if the level before it has been beaten.

On my level select screen I have code that looks at the state of if certain levels were beaten for other things as well, for example in my game every 4 levels beaten you learn a new ability. So by tracking if level 4,8,12 are beaten I can control what abilities the player has. This also means that once they have beaten those levels, they can go back and play them with their new moves since I track that those moves are now unlocked for them to use.

This is just an example of how I do things and may not be the best or most efficient but it gives me a system that I can easily understand exactly where a player is in the game and what they have done.

Also by storing the stats in globals I can do other things, for example my system of awarding medals to players is based on looking at a combination of how many gems they found in the level as well as their score. My level select screen then uses this to properly display what medal they have been awarded for that level (Bronze, Silver, Gold, Platinum, etc...).
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,573

Post » Fri Jan 31, 2014 6:57 am

ok sir thank you i got the idea now, ill try it on and see if it works with my level select or if i follow it right
B
1
Posts: 4
Reputation: 138


Return to How do I....?

Who is online

Users browsing this forum: wenwen11212016 and 7 guests