Timing Functions

0 favourites
  • 14 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Greetings to everyone. I've been testing out this program for a little over a week now, and some of the procedures seem fairly straight forward and others are quite complicated. I am demoing the program as per the claims that no programming knowledge is necessary. I think that possibly the only ones having much success with grasping this software, already have experience in coding. For the right brained folks such as myself we think more easily in terms of physical geometry and spatial relations, yet struggle with complex mathematical and algebraic equations. Without the right brained folks most games would look rather dull. Without the left brained folks your image (no matter how bitchen the sprite is) ...its still just a boring old sprite. Ok this got way to long winded...sorry. I guess I'm trying to say that this I'm quite often very mathematically challenged so forgive me if I'm slow and ask many questions.

    Ok now for the biggest question bugging me right now...

    How would I go about synchronizing a timer to start when the music actually starts playing? I set a global var for the timer to increase by one every second. however it often starts before the music. I would like to accurately sync events,anims etc. to markers in the audio track. Any help would be awesome. All I really care about is getting the counter to start when the music does.

  • It's probably one on the most difficult thing to do and understand !

    -> Using HTML5, C2 can command to the browser to play a sound.

    -> Each browser use if own logic and system to play the sound.

    -> Depending on many parameters, the sound can be play immediatly, after a loading/buffering time or not be play at all if browser restricted access to the sound playing feature.

  • Thank you naelian for your response. I'm hoping that I formed my question correctly. I'm not really as concerned about how long it takes for the music to fully load. I was just hoping that there could be some sort of event or whatever, that will check for when the background music actually starts playing or becomes audible. I have a rather dynamic piece of music that I would like to sync up certain actions to. So That is all I'm hoping for, I tried out a few different methods, with little luck.

    The type of games that I'm working on now runs throughout the entire music score. Your player does not die, yet you do not advance unless you meet a score requirement. All I want for Christmas is a way to sync actions and animations to the music. Wonder if Christmas will be in June or July? heee hee.

  • Ok, in C2 projects generally 2 kinds of sounds are used.

    Endless background looping music so no sync problems ;-p

    Very short little sound effects so with very short delay problems ;-p

    In some browsers it's possible to preload sounds to play them quickly when needed, in others only one sound can be played at a time (avoid those)

    You could use several looping musics and put some in "muted" state ... "unmuted" then to play again immediatly but of course not always from the start. It's also possible to control sound level for each sound to create a Fade in/Fade out effect so perhaps changing music "smoothly" depending on actions.

    You have no way in C2 to have a sound feedback to know really if a sound is audible, you can just control the sound level of each sound.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you naelian!

    Your last sentence answered my question. That it is not possible for a program to listen for a sound trigger. I will see if any of your workarounds help, or find a new workaround. I really appreciate your getting back with me. I usually decide on whether or not to purchase a program based on the level of support included. Its looking good here so far. Oh and naelian...I like your big green smile!

  • Oops... naelian... I just re read your response again, and now I have another question. In the first sentance of your reply, you said endless looping music.."no problem". I'm not concerned with the "sounds" triggered upon actions. Just a way to get the counter to start when the background music starts (it only plays through once). For a second there you first sentence began to give me a glimmer of hope.

  • i guess you best bet is to preload the needed sound, so you sure there's no buffering after you click "play"

    when clicked "play" you start the buffered sound and timer, then its just a matter of making timed triggers

  • Yippy! I figured out a work around. I set the background music to preload at the beginning of the layout. Then I triggered it with a global timer set at about 12 seconds into the layout giving it ample time to preload before called upon. So now the background music is triggered at a precise time. Smaller sound files can fill up the first 12 seconds. I will do my best to see how long the sound will take to load under different conditions. I don't know if twelve seconds is really all that necessary, however it would make a nice spot for some narration or something. I guess when it comes to Christmas in June, sometimes you just have to be your very own best Santa.

  • Thanks Vtrix! I noticed your help after discovering my work around.

  • You can use the "Audio: All preloads complete condition" to check when it's done preloading instead of waiting 12 seconds.

    I got carried away messing with this...

    soundSync.capx

  • Thanks Ramones! I wanted to check out your example, but ut appears I no longer have the newest version so my version let me download it. I'll get the newest version and check it out...I can't wait to see it.

  • Wow ramones that was awesome! I finally got my graphics card and my construct version updated to view your file. Thank you so much for sharing that!

  • Everyone's support has been so greatly appreciated. I mentioned in an earlier thread that I usually base my decision to buy software by the amount of support offered. Mozart! Really awesome file you shared, along with all the other input. I do not have pay pal, but I think I will talk my son into buying this program for me. Hopefully tonight!

  • That really was awesome ramones, I was thinking about doing some kind of simple tutorial on using timers to control a scene but this is perfect. Glad I did a search first lol.

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