Move to next screen Issue

0 favourites
  • 10 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • I am making a game in construct 2. It is in development phase and working perfectly. I have added the new layout to the project and that new layout is making an issue that I am having right now. The issue is that when I run the project (or even run in debug mode), it is not showing that newly created layout as expected. Instead, It goes to the first layout.

    I have checked every events in event sheet but i can't find any event that navigates to the start of the project (in this case, 'Screen 5 Q3' to 'Game Level4'). I am attaching the .capx file for the reference. Here is the link:

    https://drive.google.com/open?id=1vYg4n ... YOqEnl11aO

    Any solutions would be highly appreciated.

    Thanks

  • There are 2 non-standard addons in your .capx. Probably a good idea to either remove them or provide download links.

  • zenox98, I forgot to remove the addons because I was developing the game. Now, I have updated the link in the post. Please use that link.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • msha91 I've read your post many times but still don't understand your issue. You have lots of layouts and lots of event sheets in your project..

    Could you explain it once again? What is the problem and how is it supposed to work?

  • dop2000, Let's focus on the issue that I have with me.

    When you run the 'Screen 5' layout and drag the red colored pendulum to the right side and drop over there, it starts to move very much like pendulum, towards left side of the layout. The timer starts when it is dropped and when it reaches the left side of the layout, the timer stops and after 4 seconds, the game shows the next layout (which is 'Screen 5 Q2' that sets the pendulum animation frame on layout load to 1). The same logic and behaviour is applied to the next layout. Again, when the timer stops, the game waits for 4 seconds and the game shows the next layout (which is 'Screen 5 Q3' that sets the pendulum animation frame on layout load to 2). After 'Screen 5 Q3', it should move to the 'Game Level4' layout and that's is the issue that I am having with me.

    Now, if you run the whole project and progressively moves to the 'Screen 5' layout, then 'Screen 5 Q2' and then 'Screen 5 Q3' and after 'Screen 5 Q3', the game moves to the 'Screen 5' layout, I have noticed this by running the project in 'Debug' mode, but I can't find the reason that is causing 'Screen 5 Q3' layout to move to 'Screen 5'.

    I hope that you understand what I am explaining.

  • Thanks!

    It's hard to understand the logic behind your events, but I believe the problem is in "Screen 5 ES Q3" at event #6.

    It's triggered two times (probably because the collision happens twice).

    So this code is executed twice: "Wait 4 seconds, Go to next layout"

    As a result, your "Level 4" layout is loaded very briefly and then next layout is loaded, which for some reason is "Screen 5".

    If you open console in your browser you will see it:

    Go to layout: Screen 5

    Go to layout: Screen 5 Q2

    Go to layout: Screen 5 Q3

    Go to layout: Game Level4

    Go to layout: Screen 5

    I suggest you use "Go to layout Game Level 4" instead of "Go to next layout".

    Also, you can add Browser object to your project and use Browser->Log to output debug messages. This is how I found out that event #6 is triggered twice.

    EDIT: no, wait, "Go to layout Game Level 4" doesn't fix it.. I need more time.

  • Ok, so the first problem is that "Wait 4 seconds, Go to next layout" is triggered twice, you should probably fix it.

    But the reason why Level4 is skipped is event #31 in "Screen 4 Game Levels". When you return to Level4 the second time, Level variable is already 4, so this event immediately changes layout back to "Screen 5".

  • I tried "Go to layout Game Level4" and "Go to layout (by name)" also but same behaviour. How can I make the collision happen only once. Can I use 'Trigger Once' Event or some other logic like loop ?

    It means that I have to keep the separate event sheets for 'Game Level1', 'Game Level2', 'Game Level3' and any other subsequent 'Game Level' layouts.

  • The main error is that when you return to "Game Level4" the second time, your variables are not reset. "Level" variable still contains value 4, so event #31 changes layout back to "Screen 5".

    To tell you the truth, I don't understand what's going on in your game, all these layouts constantly changing.

    Screen 5 goes to Level 4, Level 4 goes to Level 2, Level 2 to Level 3, then back to Screen 5, then back to Level 4...

    There's probably some logic to it, but I don't get it.

    Try adding "Set Level=1" at the start of Screen 5 layout. Maybe it will help, but I don't know if this can break something else in your game.

  • I have one logic in my mind, let's see if it works.

    I have to keep track of the previous layout by setting the global variable in 'Screen 4 Game Levels' event sheet and check for the level number and the previous layout variable.

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