Class: Phaser::Sound

Inherits:
Object
  • Object
show all
Includes:
Native
Defined in:
lib/opal/phaser/sound/sound.rb

Instance Method Summary collapse

Instance Method Details

#play(args = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/opal/phaser/sound/sound.rb', line 5

def play(args = {})
  arg_list = {marker: "", position: 0, volume: 1, loop: false, force_restart: true}

  arg_list.each do |name, default_value|
    unless args.include?(name)
      args[name] = default_value
    end
  end
  
  `#@native.play(#{args[:marker]}, #{args[:position]}, #{args[:volume]}, #{args[:loop]}, #{args[:force_restart]})`
end