Last active
January 3, 2016 07:19
-
-
Save domgetter/8429058 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gosu' | |
class Game < Gosu::Window | |
def initialize | |
super 640, 480, false | |
@song = Gosu::Song.new("file.ogg") | |
@loop_time = Gosu.milliseconds | |
end | |
def update | |
duration = Gosu.milliseconds - @loop_time | |
#if 112 seconds have passed | |
if duration > 112000 | |
#play the song | |
play_song | |
#and make sure to reset the timer | |
@loop_time = Gosu.milliseconds | |
end | |
end | |
def draw | |
end | |
private | |
def play_song | |
@song.play # play song here | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment