1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GM:S 1.4 [SOLVED] Rhythm beat, local time

Discussion in 'Programming' started by Wuzzems, Jan 6, 2017.

  1. Wuzzems

    Wuzzems Member

    Joined:
    Dec 29, 2016
    Posts:
    44
    Last edited: Jan 6, 2017
  2. Fat_Man3468800

    Fat_Man3468800 Member

    Joined:
    Jun 22, 2016
    Posts:
    487
    I don't really understand that tutorial, but based on your question, is:
    Code:
    Create:
    time = 0; //Initialize variable
    audio_play_sound(snd_song,0,false); //Play song
    
    Step:
    time++;
    
    if (time == someTime) {
         doSomething();
    }
    
    good enough for you?
     
    Wuzzems likes this.
  3. Wuzzems

    Wuzzems Member

    Joined:
    Dec 29, 2016
    Posts:
    44
    OH wait, I understand it now. I didn't quite understand when he said to minus 10 from 14 and that it would be equal to 4. 14 being the elapsed time since the beginning of the game time (I took this as the literal initialization of the game but in fact it's rather the time since the beginning of the level or when you've initialized the song) and 10 being the elapsed time since the beginning of the "LOOP" song. It didn't click for me when he said loop but 4 seconds is the current time of the loop.

    But yeah you're right. I'll have to create a variable that checks for the time. Luckily I won't be using loops so I won't need another variable to minus from the other, since the initial variable will be the time of the song anyway.

    Also I'll have to divide that time variable by 60 to get seconds seeing as my room speed is 60 frames per second
     
    Last edited: Jan 6, 2017
  4. Wuzzems

    Wuzzems Member

    Joined:
    Dec 29, 2016
    Posts:
    44
    Tim Robb put it pretty clear in the comments

    1.5 being the elapsed time since the start of the level.
     
  5. Fat_Man3468800

    Fat_Man3468800 Member

    Joined:
    Jun 22, 2016
    Posts:
    487
    Glad you solved it. :)
     
    Wuzzems likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice