If layout exists

Get help using Construct 2

Post » Wed Mar 21, 2012 5:24 pm

Zephlon, I found that with Parallax layers you have to check off the box that says Show in Editor. Then move them over in the preview. It might be easier to move them in place with events than using layers?
B
19
S
2
Posts: 37
Reputation: 1,464

Post » Tue Apr 10, 2012 4:26 pm

My first game is almost ready, all levels are finished (after almost 2 months of tough work), the only thing i need to do now are the menus... if someone can show me the basics how to make a menu like on Poggle game, i need all levels to be visible in the menu but they need to be locked as in Poggle, than after the first level is finished the second to be unlocked and so on.
i guess Zephlon can answer me :), by the way, your game is very addictive hihi.
Thanks
B
10
S
3
G
3
Posts: 54
Reputation: 3,317

Post » Tue Apr 10, 2012 8:11 pm

The basic idea is that, at the end of a level, you store the highscore in a database of some kind (I used the WebStorage object). Then you create a sprite on the level select menu with one animation for unlocked, and one for locked. Then at the start of the layout you iterate through all of the levels and if the previous level has a highscore greater than zero, unlock it.

I can explain in more detail, but I'll need to know if you want the menu to be automatically generated and if you want multiple pages.
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Post » Wed Apr 11, 2012 11:09 am

Hey, please check this capx. this is how far i can get... you`ll just need to add some events to help me.

http://dl.dropbox.com/u/67937942/Menus.capx

Thanks
B
10
S
3
G
3
Posts: 54
Reputation: 3,317

Post » Thu Apr 12, 2012 3:55 am

First, you can have more than one layout share the same event sheet. Second, each of the level boxes should be multiple instances of the same object. (Create the first one, name it, and then move it while holding ctrl to copy. Or, right-click>copy, then right-click>paste.) To have multiple frames for one object, open the first one, create a new frame (right-click in the frames window, click add frame), make sure the new frame is selected, and open the next image.

Try this:
http://dl.dropbox.com/u/52788071/Menus.capx

Does your game keep track of score? If not, we'll need to do this differently; because this is like a level select menu and high-score system in one.
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Post » Sat Apr 14, 2012 12:07 pm

Hi, Again

Thanks for the help, but the problem is that all my levels are done in a different events, cause every level have different variables like, health, time limit is different every level. Tried to do it this way like you have shown me, but cant do it, i guess it is because the different events, if you have any suggestions, please tell if not i guess i`ll have to think hard :).

Thanks
B
10
S
3
G
3
Posts: 54
Reputation: 3,317

Post » Sat Apr 14, 2012 5:07 pm

You can have the variables that are different attached to an object (like the player). Just click on the object, go to properties, and click "Add/Edit Instance Variables". Then if there isn't anything else different, delete all of the event sheets but one (except for the menu events) and make sure all of the levels point to the same event sheet.
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Post » Tue Apr 17, 2012 12:27 pm

Thanks for the help, but i find some other solution, i took 10 different sprites, one for every level, then add few events like

system.every tick - set opacity to 40 for all level boxes in the menu.

Then i added few events on every level.

When level 1 is finished - add 1 to "unlock level2" (global variable)

Again in the menu events i added,

If Unlock level2 = 1 - then set level 2 opacity opacity to 100% and       

On levelbox2 clicked, and -
levelbox2 opacity is 100% - system go to level 2

and so on for every level.

Thanks for the help again


B
10
S
3
G
3
Posts: 54
Reputation: 3,317

Post » Tue Apr 17, 2012 7:04 pm

That would work, but it won't save the player's progress. So if the player closed the game and reopened it, he would be back at level 1.

Also, it is not a good idea to have multiple copies of the same event sheet. Even if some of the variables have different values.

  • What if you wanted to change how the game works? You'd have to change the same little thing for all of the levels.

  • It increases the file size more than nessesary. In a case where you have a lot of events for each level, the player will become impatient when your game takes forever to load and go find a different game to play.

  • If you wanted to add a few levels, you'd have to duplicate one of the event sheets and change it accordingly.



It is better not to repeat the same instructions over and over, but instead to say it once and put variable where it's different.

Instead, you should do something like this:

Make one sprite object, name it levelbox. Right-click on it, choose add/edit instance variables, click the green plus sign, name the variable level and give it a type of text, click ok, and close the add/edit instance variables window. Hold ctrl and move the levelbox. This copies it. Do this until you have enough for each level. Edit each one to have the name of one of the levels (layouts) in the level instance variable (you can find it in the properties). If you don't want to type the name out each time, you can copy something like "Level " to the clipboard and paste that into the textbox then type the number. Example: Click levelbox, click the box next to "Instance Variables, level", press Ctrl+V, type "1", click the next levelbox, click the box next to "Instance Variables, level", press Ctrl+V, type "2", etc.

-- Menu Events --

system.every tick -> set opacity to 40 for all level boxes in the menu.

Declare Local Variable unlock_level = 1
System - For Each levelbox
If unlock_level = 1 -> then set levelbox opacity to 100%
(Event with no conditions) -> System > set variable unlock_level to WebStore.getLocalKey(levelbox.level)

On levelbox clicked, and -
levelbox opacity is 100% -> system go to levelbox.level

-- Game Events --

When a level is finished -> WebStorage > Set Local Key > LayoutName to 1.
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Post » Wed Apr 18, 2012 10:06 am

Well my game is already finished and i need to change everything to make it like you said, everything in one game event sheet, but definitely i will use you advice in some future projects.

BTW i placed save and load option http://www.scirra.com/forum/webstorage save-game_topic46118_post288827.html in the game for saving levels.

Only thing left to do is high score, you can check this if you can help somehow.

http://www.scirra.com/forum/highscores-timelimit_topic51230.html
B
10
S
3
G
3
Posts: 54
Reputation: 3,317

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests