samples/01_rendering_basics/05_sounds/app/main.rb
def tick args
  args.outputs.labels << [640, 360, "Click anywhere to play a random sound.", 0, 1]
  args.state.notes ||= [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4]

  if args.inputs.mouse.click
    # Play a sound by adding a string to args.outputs.sounds
    args.outputs.sounds << "sounds/#{args.state.notes.sample}.wav" # sound of target note is output
  end
end
# Runs all the methods necessary for the game to function properly.
Runs all the methods necessary for the game to function properly.
Runs all the methods necessary for the game to function properly .
def tick args
  args.outputs.labels << [640, 360, "Click anywhere to play a random sound.", 0, 1]
  args.state.notes ||= [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4]
  if args.inputs.mouse.click
    args.outputs.sounds << "sounds/#{args.state.notes.sample}.wav" 
  end
end
def tick args args . outputs . labels << [ 640 , 360 , "Click anywhere to play a random sound." , 0 , 1 ] args . state . notes ||= [ :C3 , :D3 , :E3 , :F3 , :G3 , :A3 , :B3 , :C4 ] if args . inputs . mouse . click args . outputs . sounds << "sounds/#{args.state.notes.sample}.wav" end end
Runs all the methods necessary for the game to function properly.
Runs all the methods necessary for the game to function properly .
# Play a sound by adding a string to args.outputs.sounds # sound of target note is output
args