Create levels and transitioning between them

Get help using Construct 2

Post » Thu Apr 12, 2012 6:38 am

So I finally managed to get my test game to move to the next level (had a few seemingly random issues preventing me from doing it...) but now I'm confused on how to proceed.

I'm using Ashley's beginners tutorial as a template just for your info, and I want to add multiple levels with screens inbetween them. For example. Currently level 1 you have to kill 10 things, once the kill counter reaches 10 you move to level 2 and have to kill 20 things and so on.

I want a screen inbetween so it's like: level 1 -> kill 10 to move to level 2 -> display a screen with a next button to proceed to level 2 -> click next -> start level 2 -> kill 20 to move to level 3 -> display screen with next button -> click next -> start level 3. And so on.

I want that screen for every level but I'm not sure how to do it properly. The only way I can think of is to create the blank screen with a next button manually for each level, and make each button point to the next level. It seems like a very tedious and bad way to do it. Isn't there any automatic way I can tell the game to progress? Or a way I can use the same layout with the next button for all transition screens? Something like "move to next level" when clicking on next rather than "move to level 2" and "move to level 3" on each one.

If you want to actually take a look at how it runs here it is, though I didn't change very much. I want to get the basic functionality working properly before I do anything else.
http://dl.dropbox.com/u/62853646/testgame/index.html
capx:
http://dl.dropbox.com/u/62853646/testgame/tutorial2levels.capx

If you know any better way to do anything I was trying to do please let me know. A lot of it seems very crude. Especially with creating levels. I basically just duplicated my first layout and renamed it, but I was having issues trying to change certain things only in one layout but it would change it in both. I deleted it, reduplicated and somehow worked fine the second or third time, so I'm sure I'm doing something wrong. I just didn't want to recreate every single thing since the levels are identical (excluding background color).Seraphyx2012-04-12 19:01:18
B
7
S
2
G
3
Posts: 10
Reputation: 2,279

Post » Thu Apr 12, 2012 8:06 pm

What you are doing basically works, but it isn't particularly elegant or efficient.

I've included two examples for you to look at, including the intermediary screen between levels.


BunnySteps.capx

This one only has one layout and one event sheet that keeps getting called over and over, but a new, very simple level is autogenerated each time. The message between "levels" is actually just another layer that is hidden until it is needed. I think there are something like 15 or 16 levels generated before it ends.


BunnyHop.capx

This one has 5 different layouts. One of them is the intermediate message layout that is displayed between levels. The other four are different levels. However, there is only one event sheet shared by all of the level layouts, and one used by the message layout, and another exclusively for declaring global variables. Putting the globals in a separate event sheet makes it easier to share the event sheets between levels as well as easier to find and modify the global variables. You could easily add more levels by just creating the layouts named "level 5", "level 6", etc and changing the global variable NumberLevels to correspond to the last level. You also need to set the event sheet for each layout by clicking on the layout name in the project panel to select it and then changing it's event sheet in the properties panel to "Level Events".

If you like one approach over the other and have questions about it, I'd be happy to try to answer them. Good luck!kittiewan2012-04-12 20:21:10
B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Thu Apr 12, 2012 9:35 pm

(for the most part I seem to understand bunnyhop much easier, so I will probably try that method first. The rest of the post is just longer explanation. Figured I'd add this in in case someone doesn't want to go through the giant post. I think I will figure out the bunnyhop though but feel free to post further explanations if you'd like, I am not opposed to that at all I may also just start from scratch (the end of the tutorial) again to rewrite everything and make it less convoluted and messy. I don't want to deal with trying to reorganize it as it is now)

Thanks very much for those examples. They look so simple and concise which is kind of blowing my mind, I'm still trying to wrap my head around what is doing what. Right now I understand the second one more than the first example (mostly skimmed for now since it's late but I'm understanding the hop much easier), although I'm not sure which would be appropriate for my game. The area never changes in terms of shape and where you can and can't move, only the background changes. So I don't see how I could use the first one (it may very well be possible, I just wouldn't know how to, and I don't understand how it knows where to place each block as you progress in levels. I will have to try and make sense of it more later on).

I forgot to mention this in my OP but the screen between levels will be used for things like buying weapons or various upgrades. So I need it to stay on that screen until the "next" button is pressed, which will take you to the next level. I don't understand how the game knows to move to level 2 in BunnyHop vs level 3 or any other level. I'm guessing it obviously has something to do with levelnumber variable. I think I understand, I will try the bunnyhop method of moving through levels in a while (probably after I wake up). One question I have is on the Message Events sheet, the third txtMessage "set text to "Level" & LevelNumer & "complete!"

Where is the "complete!" from and what does it do? I didn't see that anywhere else. When I first run the game it starts off by saying Level 1 complete! then moves onto the first level. Just kind of odd and I wouldn't want it to start off like that if possible. I have some other concerns about the intermediate screens but I'll get to that after this I suppose. Can't try to fix/resolve everything at once (which I often try to do unfortunately).

I'd honestly probably need someone to break down each piece of code so I can understand it or explain it as it's being created and what purpose it serves so I can see what links to what. It's very possible I'm over-thinking things since I tend to do that. I'm also pretttty slow learning things, just takes a while for it to click. So far Construct seems to be the easiest to understand out of all the other programs I've tried though, so I have high hopes for actually being able to complete something.Seraphyx2012-04-12 22:17:13
B
7
S
2
G
3
Posts: 10
Reputation: 2,279

Post » Fri Apr 13, 2012 4:08 am

Yeah, I like Construct 2 because it clicks with the way I think better than most of the other tools.

You're probably right that you are overthinking a bit, but it takes time to wrap your mind around this stuff. In my experience, one has to experiment a bit and break a lot of things before it starts really making sense.

If you used Bunnystep, you wouldn't be creating all of the platforms. That was just what my example did to show how autogeneration of a level could be done.

To blow your mind a little more, I present BunnyRun:

BunnyRun.capx

Yes. BunnyRun. Heh, heh. It is a combination of BunnyHop and BunnySteps, more targeted to your actual case. There is one layout for the levels, with different backgrounds depending on the level number. Also the number of points required to get to the next level gets higher each level. (the points are sort of like your monster kills needed to get to the next level.)

Also, between levels there is a store level with its own event sheet. The player does some stuff and then clicks a button to go to the next level. If there are no more levels "The End" is displayed instead of the store, but you could display the store again, or whatever you want.

There are comments in this one that may help you understand it better.

As far as the problem you were having with BunnyHop first level, I think you may have run the game after going to a different level, or perhaps I saved it that way. Go to the Level 1 tab and then run the game and see if it is better. You can specify the first layout in the property panel for the project, but when you click the Run button inside C2 it starts with the last level which is very useful if you just want to test that level, but it can lead to some odd behaviors.

re the txtMessage, you asked where the "complete!" comes from and what does it do?

It is just a string. You could just as easily say " finished!" or anything else.

txtMessage "set text to "Level" & LevelNumber & " complete!"

will just display "Level 1 complete!" at the end of the first level,
"Level 2 complete!" at the end of the second level, etc.


kittiewan2012-04-13 04:30:59
B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Fri Apr 13, 2012 3:35 pm

Ohhhhh. Man I thought it was another variable or something and I wasn't seeing what it does (shows how tired I was lol). The quotes around it should have given it away that it's just a string. /facepalm

The bunny run is REALLY cool. I'll very likely use that. The issue I always have is that I try to understand everything as much as I possibly can, and it bothers me if I don't. It's the same issue I had in my math classes. I saw kids just breeze through it even though they didn't really understand what was going on, just doing what they're told. Eventually I did the same because me trying to understand every single thing was holding me back.

I have the same issues with programming (took a basic intro class to c++) so it's not the best thing for me to learn, I just have to kind of deal with it and leave things alone (for now). I understand how to do the examples and what I need to do, but don't "get" how some stuff works just that it does. Either way I'll look through bunny run some more and try that out. The comments do help a lot. And Construct helps with quickly trying things out since you don't have to manually type in everything, go back in, check for errors or how to change things around, delete everything and rewrite out everything in a different way, etc... So that's cool.
B
7
S
2
G
3
Posts: 10
Reputation: 2,279

Post » Fri Apr 13, 2012 8:06 pm

Glad I could help. There are so many different ways to do something, even with a structured tool like Construct 2, that experimenting is really key to understanding. I actually have a fairly complex game in mind that I really want to make, but I'm holding off on making it until I've made a dozen silly little games. Then I think I'll be ready to attack it. So far I'm about 1/2 way there....

B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Wed Jun 13, 2012 2:50 pm

Just what i was looking for!, thanks both of you, for asking and responding!
B
28
S
5
G
4
Posts: 51
Reputation: 3,857

Post » Wed Aug 01, 2012 5:05 am

@Seraphyx, Great questions. I was wondering about some of the same things.

@kittiewan, Don't know what to say, but "you are the man" with your explanations and .capx file examples. From reading your profile I can see you have a breadth and depth of experience and knowledge that really comes in handy.
B
28
S
4
G
3
Posts: 70
Reputation: 4,874

Post » Wed Aug 01, 2012 1:06 pm

@jwjb Hey, didn't I just run into you over in the arcade? Well, welcome to the Construct 2 universe. I'm always glad to hear that my silly little examples are useful to someone.
B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Sun Aug 19, 2012 3:51 pm

Nice example, thank you
B
18
S
3
Posts: 5
Reputation: 1,426

Next

Return to How do I....?

Who is online

Users browsing this forum: CavalierBubble, imnotspecial, tomi71, totoe and 23 guests