Class: RPG::BGM

Inherits:
AudioFile show all
Defined in:
lib/rpg/bgm.rb

Constant Summary collapse

@@last =
RPG::BGM.new

Instance Attribute Summary collapse

Attributes inherited from AudioFile

#name, #pitch, #volume

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AudioFile

#initialize

Constructor Details

This class inherits a constructor from RPG::AudioFile

Instance Attribute Details

#posObject

Returns the value of attribute pos.



28
29
30
# File 'lib/rpg/bgm.rb', line 28

def pos
  @pos
end

Class Method Details

.fade(time) ⇒ Object



20
21
22
23
# File 'lib/rpg/bgm.rb', line 20

def self.fade(time)
  Audio.bgm_fade(time)
  @@last = RPG::BGM.new
end

.lastObject



24
25
26
27
# File 'lib/rpg/bgm.rb', line 24

def self.last
  @@last.pos = Audio.bgm_pos
  @@last
end

.stopObject



16
17
18
19
# File 'lib/rpg/bgm.rb', line 16

def self.stop
  Audio.bgm_stop
  @@last = RPG::BGM.new
end

Instance Method Details

#play(pos = 0) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/rpg/bgm.rb', line 4

def play(pos = 0)
  if @name.empty?
    Audio.bgm_stop
    @@last = RPG::BGM.new
  else
    Audio.bgm_play('Audio/BGM/' + @name, @volume, @pitch, pos)
    @@last = self.clone
  end
end

#replayObject



13
14
15
# File 'lib/rpg/bgm.rb', line 13

def replay
  play(@pos)
end