Class: RPG::BGS

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

Constant Summary collapse

@@last =
RPG::BGS.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/bgs.rb', line 28

def pos
  @pos
end

Class Method Details

.fade(time) ⇒ Object



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

def self.fade(time)
  Audio.bgs_fade(time)
  @@last = RPG::BGS.new
end

.lastObject



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

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

.stopObject



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

def self.stop
  Audio.bgs_stop
  @@last = RPG::BGS.new
end

Instance Method Details

#play(pos = 0) ⇒ Object



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

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

#replayObject



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

def replay
  play(@pos)
end