0 Favourites

How do I Stop My Levels From Randomly Skipping?

  • Hello all, I was wondering why, from time to time, my levels will skip (only levels 7-10), but other times I'm able to play through the entire game without any problems at all? (Besides this problem) My game's finished and I want to post it soon, but I don't want to post the full game yet. Here's the complete code (it's long, but I had to get it all in if I'm ever going to figure out what the problem is):

    Here's an example of the problem I'm having: When I win the 8th level, I'll click the "go to level 9" button, but instead of bringing me to level 9, it will go back to the beginning of level 8. The same thing happens, from time to time, for levels 7-10, but never for levels 1-6 for some reason.

    https://dl.dropboxusercontent.com/u/541 ... pture1.PNG

    https://dl.dropboxusercontent.com/u/541 ... pture2.PNG

    https://dl.dropboxusercontent.com/u/541 ... pture3.PNG

    https://dl.dropboxusercontent.com/u/541 ... pture4.PNG

    https://dl.dropboxusercontent.com/u/541 ... pture5.PNG

    https://dl.dropboxusercontent.com/u/541 ... pture6.PNG

    https://dl.dropboxusercontent.com/u/541 ... pture7.PNG

    Thanks,

    guannstar

  • To me it looks like a bunch of your level start functions are actually empty functions.

  • What do you mean? Should I delete all of them?

  • Is that the only problem you can see?

  • Honestly, I think I think your code is too long for someone to debug using pictures.

    So right now when your program starts it reserves memory for all of those global variables and stores their initial value.

    Then it gets to line 1 and says to itself "Okay, I need to update that text with varScore twice every tick"

    Then it gets to line 2 it says "This event is true, so lets do the action."

    Then it goes down to line 338 and executes that function call. Turning all of those things to invisible. (By the way we can't see any of the object in your actions because the names are hidden in your pictures.)

    So after the program does everything in that function it goes back to line 3.

    The conditions of the event on line 3 - 11 are all false at this point so it skips them and continues to the next line.

    So I assume at some point the conditions of the event on line 5 become true. So it's going to go to line 365 for the function call. But since the function on line 365 is empty it will immediately go back to line 6. So that was basically unneeded code as it is now.

    I think I'd start debugging by looking at where you are changing Active_level. It's easy enough to do in C2 by clicking on the Events tab and entering in Active_level in the search field. So you can see exactly where it's used. In your images... not so easy...

  • Bump... So, should I delete all of the empty function calls as well as lines 3-11?

  • Well if the functions are empty you might as well, since they don't do anything anyway. Except 11 because it looks a bit weird, "On start of layout" (Line 12) are link to "Active level 10" (Line 11) What is the reason for it to be link to that only, ain't all the levels the same in regards to the high score or?

    But as already mentioned its not easy to debug that much code, but think you could try to make a level tester, in the sense that you make a button or a key, that when you press it advance the level by one, and then you check that the variables that have something to do with switching levels are correct. So run it in the debugger and each time you switch level you go through the relevant variables and check that they are correct.

  • guannstar buddie your code is perfect. i just want to tell you one think

    # have you delete the function part of lvl 10 when your were making the code.

    # construct2 take some time to update that thing.

    # if the bug still persist then i have a quick solution . delete or uncomment on the lvl 10.

    # now put againg the lvl 10 code do not copy form lvl 9.

    # Export the project and close construct.

    # now again import the project from exported folder. this should work.

  • samblack Hey, thanks for the help. Can you show me what you mean when you say, "have you delete the function part of lvl 10 when your were making the code."? I don't get it:( Can you show me what you mean?

    Thanks again (I really appreciate all the help).

  • Bump... can someone please help me out with what 'samblack' said above? I'm not sure what he means. Thanks all.

  • Also, nimos100, what did you mean by, "Except 11 because it looks a bit weird, "On start of layout" (Line 12) are link to "Active level 10" (Line 11) What is the reason for it to be link to that only, ain't all the levels the same in regards to the high score or?"

    I don't see any link on line 11 at all:(

  • Bump:(

  • [quote:9jpygpi8]Also,

    nimos100

    , what did you mean by, "Except 11 because it looks a bit weird, "On start of layout" (Line 12) are link to "Active level 10" (Line 11) What is the reason for it to be link to that only, ain't all the levels the same in regards to the high score or?"

    I don't see any link on line 11 at all:(

    "On start of layout" in event 12, its a sub event of event 11, which seems a bit weird. it only apply when Active_level = 10?

    [quote:9jpygpi8]samblack Hey, thanks for the help. Can you show me what you mean when you say, "have you delete the function part of lvl 10 when your were making the code."? I don't get it:( Can you show me what you mean?

    Sorry have no clue what he is talking about

  • Hey nimos100, thanks for the help. So... I deleted line 3 to 10 because the functions had no use, and, I also made it so that line 12 (which is now line 4) is no longer a sub-event.

    Is that all I needed to do? Does the rest of my code look fine?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Ok think you misunderstood what I meant, I have no clue if that solves anything or not. I just found it weird looking, so just wanted to make you aware that it might not be the way you wanted it to be. But if things still seems to work, and the high score, which I assume that sub event had something to do with is still working, then its probably didn't hurt.

    But there are to much code for me look through and not a lot of comments to go with it. But if you say that it only happens from level 7-10, then you have a good place to start, try to compared the difference between switching level from 5 to 6 and from 7 to 8.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)