[RESOLVED] Unlock corresponding level & menu

Get help using Construct 2

Post » Sun Jul 01, 2012 12:12 am

Hi C2 community,

I'm a trying to make a sytem which unlock the levels when it's completed. I've look at the level tutorial;

http://www.scirra.com/tutorials/311/level-page

But it doesn't do exactly what I need :S.

PROBLEM
- In my game, a level can be replayed (to collect stuff).
In the current tutorial, the value current.level add one no matter which level has been completed. Considering this, if the player completes the same level over again, it unlocks the others!

- Also, I dont know how make a button available (MENU)only when the level is unlocked. For now, touching a level button goes to the corresponding layout even if the level isnt unlock.

WHAT I WANT
-     A level can only be unlocked once, but the player can replay it as much as he wants.
-     From the MENU, a level can be loaded only if it's unlocked.
-     A button continue load the last unlocked level.

FILE CAPX

Unlock LevelstutorialDirtyArts2012-07-02 08:42:05
Create HTML5 games
B
9
S
1
Posts: 29
Reputation: 1,323

Post » Sun Jul 01, 2012 5:39 am

[QUOTE=DirtyArts]

WHAT I WANT
-     A level can only be unlocked once, but the player can replay it as much as he wants.
-     From the MENU, a level can be loaded only if it's unlocked.
-     A button continue load the last unlocked level.

[/QUOTE]

the first point :
you want when you click on the button (level1) it will take you to layout for level 1 and if you clicked button for level2 it will take you to layout level2 right??

if it like this then you just need to change the event number (11) in "event sheet 1" (in the example capx)
to this :
event:
     condition1:mouse left clicked on button
     condition2:value at levelsbutton.level>0
     action1: system :go to (by name) ---> and write this : "LVL"&levelsbutton this mean it will take you to layouts with names :LVL1,LVL2,LVL3... so name your layout as this..
     action2: set currentlevel to levelsbutton.level

*so just change action1 and layout names.

the second point and the 3rd point i didn't understand what you need ? can you explain what you have did and what happened and what you want to happen


B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sun Jul 01, 2012 5:41 am

I don't have time right now to look at your game, but have you checked out my treasure map tutorial? You could use the same technique to create a menu. (Link is below.)

EDIT: Oops. zsangerous beat me to it, but basically we're taking the same approach.

kittiewan2012-07-01 05:43:55
B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Sun Jul 01, 2012 5:54 am

@kittiewan , your signature is blocked in my country :) can you change tinyurl.com :P
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sun Jul 01, 2012 6:56 am

- From the MENU, a level can be loaded only if it's unlocked.

Let's clear this with an example:

Suppose that my game have 5 levels. When my character collides with the end sprite at the end of a level, it makes the current level state to 'completed' and 'unlock' the next one which becomes available from the 'MENU' layout. (ex: complete LV0 makes LV1 available from the MENU layout).

The problem is each time the player collides with an end sprite, the value of 'current.level' add 1.

As an example, if I replay the LV0 5x times, all levels are unlocked in a row, but the player haven't completed the Level_1, 2, 3 and 4!They are supposed to be locked.


- Complete a level to unlock the next one (becomes unlock from the MENU layout.

------------------------------------------------------------
- A button continue load the last unlocked level.

Let's forget about this one... :)


Thanks for your help, I'll take a look at the button stuff.
Just ask again if it's unclear :)DirtyArts2012-07-01 06:58:53
Create HTML5 games
B
9
S
1
Posts: 29
Reputation: 1,323

Post » Sun Jul 01, 2012 6:58 am

I'll take a close look at it to know if it makes what I need and give you feedback on this.

Thx for helping.
Create HTML5 games
B
9
S
1
Posts: 29
Reputation: 1,323

Post » Sun Jul 01, 2012 7:06 am

hmm could you upload the capx? if you can't show me the event that player collide with gate at least let me know what im doing , do you need the stars system or no??
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sun Jul 01, 2012 8:57 pm

[QUOTE=zsangerous] @kittiewan , your signature is blocked in my country :) can you change tinyurl.com :P[/QUOTE]

@zsangerous,
I had to use tinyurl because of the character limit in the signature. The links to the tutorials are SO long...

However, here are the direct links:

Making an interactive treasure map

Making a Memory Match Game
B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Mon Jul 02, 2012 4:35 am

UPDATE

I've try to use the 'Map tutorial' and adapt it to my needs. Well it works the way I want for the unlocking system. Therefore, I've try to implement the 'sprite state' from the level-page tutorial. I also need a collectible star system.

I've make a new CAPX and added code from the level-page tutorial. So it's there... but not functional.

NEW CAPX
https://dl.dropbox.com/u/26046730/Unlock.capx

Thx for your help, you deserve REP points :)DirtyArts2012-07-02 04:40:31
Create HTML5 games
B
9
S
1
Posts: 29
Reputation: 1,323

Post » Mon Jul 02, 2012 5:57 am

ok , i really don't know why you didn't like my tutorial o.o what is the point that you didn't understand it?? anyway when i saw your capx there are many weird stuffs for example when i win it just open the next level but it doesn't fix the button it doesn't show you got 1 star or 2 and so on ... also you used frames and useless variables like Layout variable. and even worst the unlock levels has names 0.0 so i fixed all of them i wish you like it but please try to read the whole tutorial before you ask even try to see what i'm talking in the tutorial (download my capx)
ok you can just use this as just 3 levels on it ^^

https://dl.dropbox.com/u/67034121/scirra%20construct2/Unlock%20zsangerous%20edtion.capx
i hope you like it , good luck in your game :)
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Popcan151, Skebab, Yahoo [Bot] and 17 guests