While loop breaks browser

0 favourites
  • 6 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies. For use in game and custom works.
  • I don't know why the program hangs. I approached it differently but I did not find a solution. This arrangement of blocks is logical to me.

    and c3p file:


    I play foot1 sound every 0,7 seconds for 5 seconds.

    I increase the counter by 1 every 1 second, but unfortunately while loop hangs the browser.

    Audio file is ok, isn't this counter increase working?

    Could someone suggest?

  • It loops infinitely. It will never stop because "every" events do not work if you keep re-checking them within the same tick. You have to let the rest of the events keep running.

  • The while loop runs continuously, blocking all other actions until it's condition becomes false. If you remove the "while" condition and just have the "timecounter < footstepsTime" in your event then it will check the conditions once per frame, which I believe is what you want.

  • Thanks guys! Now I understand, I overdid it :-D

    I removed while loop and the game does not hang the browser. But the sound does not start.

    The sound is played only when I removed "System: Trigger once" in calling the function. But the steps are endless than.

    I thought that if the function was activated once, the sound would appear in the given amount of time in parameter. What else did I miss in my reasoning?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you need to play the same sound several times, try this:

    Repeat footstepsTime
    	Wait loopindex*footInterval
    	Play "Foot"&groupNumber
  • Wow! Thanks a lot!

    I have modified a bit and now I have advanced footsteps on request.

    I choose the group, the intervals between steps (whether the player is walking or running) and how long the steps should last. And the system randomizes the sound and performs a light retouching with the filter.

    This is amazing, cool, wonderful, brilliant, gorgeus, spectacular, beautiful, stunning!

    damn, I didn't know that I know so many cool words in English! :-D

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