BUG with function and layout?

0 favourites
  • 7 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • Why does the call to a function disappear when going to another layout?

    The actions of the function after changing layout will not be executed. If you assign a value to a global variable, the value will not be assigned.

    Both layouts are assigned the same eventsheet

    In this code, the text of layout number 2 is not destroyed.

    dropbox.com/s/nfzakvny1ggsp18/testLayoutFunction.capx

  • Why does the call to a function disappear when going to another layout?

    The actions of the function after changing layout will not be executed. If you assign a value to a global variable, the value will not be assigned.

    You are using "Wait" after you change layouts which will not work because the layout change it will happen on the same thick, not 2 secs after, that's why the variable doesn't get updated.

    If you need two wait 2 secs then you can make the action for the layout change at the end of the Actions so it runs last.

    Or just remove the wait.

    In this code, the text of layout number 2 is not destroyed.

    You cannot modify anything from a different layout, any events that are running applies just to the current layout.

    So on the second layout the function it will not get called as you have a condition that checks only if the layout it's equal to layout 1

  • I think you are interpreting the code in a different way from my conception.

    The example starts in layout 1.

    The issue here is: what happens to the function code when it goes to layout 2? Is that operation correct?.

  • I already explained in my first post:

    In this code, the text of layout number 2 is not destroyed.

    You cannot modify anything from a different layout, any events that are running applies just to the current layout.

    So on the second layout the function it will not get called as you have a condition that checks only if the layout it's equal to layout 1

    Meaning on layout 2 at start of layout event, it checks only if (Layout Name = Layout 1) to call the Function, therefore the function it will not get called as you are on "Layout 2" so the condition it's false

    Also, you cannot call the function on layout 1 to be executed on layout 2, construct runs layout by layout so when you switch layouts al the current events running they will stop, on layout 2 it will load again the event sheet that is linked to the new Layout which on this case is the same event "sheet 1" so all the events starts from the beginning

    I hope I explained properly if not just tell me whats the part you don't get and I will try to explain it differently

  • Then the answer is that the events that remain in the execution queue are removed when you change layout.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Then the answer is that the events that remain in the execution queue are removed when you change layout.

    Basically, you just repeated the same thing I explained on my first post it was a two-part answer, I'm not sure if you saw it, you just said it differently

    You are using "Wait" after you change layouts which will not work because the layout change it will happen on the same thick, not 2 secs after, that's why the variable doesn't get updated.

  • I saw it, but it was not entirely clear for other reasons.

    Ok, thanks for the information.

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