Class: Pacman::Arcade::Scoreboard

Inherits:
Object
  • Object
show all
Defined in:
lib/pacman/arcade/scoreboard.rb

Constant Summary collapse

PELLET_POINTS =
10
POWER_POINTS =
50
FIRST_GHOST_BONUS =
200

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScoreboard

Returns a new instance of Scoreboard.



12
13
14
15
# File 'lib/pacman/arcade/scoreboard.rb', line 12

def initialize
  @total = 0
  reset_combo
end

Instance Attribute Details

#totalObject (readonly)

Returns the value of attribute total.



10
11
12
# File 'lib/pacman/arcade/scoreboard.rb', line 10

def total
  @total
end

Instance Method Details

#ghost!Object



25
26
27
28
29
# File 'lib/pacman/arcade/scoreboard.rb', line 25

def ghost!
  bonus = award(@next_ghost_bonus)
  @next_ghost_bonus *= 2
  bonus
end

#pellet!Object



17
18
19
# File 'lib/pacman/arcade/scoreboard.rb', line 17

def pellet!
  award(PELLET_POINTS)
end

#power!Object



21
22
23
# File 'lib/pacman/arcade/scoreboard.rb', line 21

def power!
  award(POWER_POINTS)
end

#reset_comboObject



31
32
33
# File 'lib/pacman/arcade/scoreboard.rb', line 31

def reset_combo
  @next_ghost_bonus = FIRST_GHOST_BONUS
end