Class: Game_Timer

Inherits:
Object
  • Object
show all
Defined in:
Game_Timer.rb

Overview

** Game_Timer


This class handles timers. Instances of this class are referenced by

$game_timer.

Instance Method Summary (collapse)

Constructor Details

- (Game_Timer) initialize


  • Object Initialization




12
13
14
15
# File 'Game_Timer.rb', line 12

def initialize
  @count = 0
  @working = false
end

Instance Method Details

- (Object) on_expire


  • Processing When Timer Reaches 0




53
54
55
# File 'Game_Timer.rb', line 53

def on_expire
  BattleManager.abort
end

- (Object) sec


  • Get Seconds




47
48
49
# File 'Game_Timer.rb', line 47

def sec
  @count / Graphics.frame_rate
end

- (Object) start(count)


  • Start




28
29
30
31
# File 'Game_Timer.rb', line 28

def start(count)
  @count = count
  @working = true
end

- (Object) stop


  • Stop




35
36
37
# File 'Game_Timer.rb', line 35

def stop
  @working = false
end

- (Object) update


  • Frame Update




19
20
21
22
23
24
# File 'Game_Timer.rb', line 19

def update
  if @working && @count > 0
    @count -= 1
    on_expire if @count == 0
  end
end

- (Boolean) working?


  • Determine if Working


Returns:

  • (Boolean)


41
42
43
# File 'Game_Timer.rb', line 41

def working?
  @working
end