What is the preferred way to wait?

0 favourites
  • 5 posts
  • Hi, I'm having a timing issue.

    I start some music on start of layout. I want to Trigger a fade out when there is 5 seconds of the audio track left.

    but this event fires immediately. I assume because in the first tick, the audio stuff isn't setup or something... as a test I added a "Every 1 second" and it worked, but I of course don't want to do that.

    what is the preferred way to wait (without making some other Timer) and make this code work after the Audio object is all set and running?

  • This seems like a good place to actually use the wait action.

    In the same event, you can start playing music, wait duration-5 seconds, fade music.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • oosyrag I have already tried that and it does not work. I tried waiting before the Play, after the Play, pulled the Play out of OnStart and put it into a Trigger Once at the top of the sheet... no waits work.

    Somehow the Duration is 0 on the first tick, but the tag is set.

  • oosyrag oh you mean put the fade stuff in the same event I play after a wait?

    I can't do that, what if the player wants to skip? just feels like runaway code I can't control once started.

  • Looks like audio.duration is not available on the same frame it starts playing.

    This is likely due to music files being streamed.

    If you use preload, and play only after preload complete, then audio.duration is available on the same tick and your trigger once event should work as expected.

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