Unexpected Game Freezing

0 favourites
  • 8 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • I don't know why but my game keeps freezing as soon as I hit the red button.

    Could anyone tell me why it keeps freezing and how to fix it?

    Photos of the code are below:

  • "Is touching" condition is continuous, it repeats many times per second while the finger is touching the screen. You need to use a trigger condition - "On touched" or "On tap", they will only be triggered once.

  • I tried both of these fixes:

    Both crash when the "sprite" is clicked.

  • I just noticed you have "While" loops with "Trigger once". You are probably creating an infinite loop, press F12 and check for errors in the browser console.

    Can you explain why do you have "While" loop and what exactly are you trying to do in that function?

  • The while loop is supposed to make random numbers in an array.

    Also how do I use the browser console to help me as it just says nothing when I initiate the crash.

    Also thanks for helping!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh also removing the trigger once makes no difference.

    :(

    (Including the one in the lengthofpattern = 0 one.)

  • You should definitely remove all "Trigger once" from the function, don't use them.

    I am pretty sure that the second "While" loop is infinite and that's why the browser freezes.

    If you look at the very first screenshot in your post, it has While loop in event #9. It checks if LengthOfPattern2<NonChangeableLenghtOfPattern, but these two values are not changed inside the loop. So the loop just never ends.

  • I figured it out with your advice!

    Thanks for your help!

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