Class: Pacman::Arcade::Scoreboard
- Inherits:
-
Object
- Object
- Pacman::Arcade::Scoreboard
- Defined in:
- lib/pacman/arcade/scoreboard.rb
Constant Summary collapse
- PELLET_POINTS =
10- POWER_POINTS =
50- FIRST_GHOST_BONUS =
200
Instance Attribute Summary collapse
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #ghost! ⇒ Object
-
#initialize ⇒ Scoreboard
constructor
A new instance of Scoreboard.
- #pellet! ⇒ Object
- #power! ⇒ Object
- #reset_combo ⇒ Object
Constructor Details
#initialize ⇒ Scoreboard
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
#total ⇒ Object (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_combo ⇒ Object
31 32 33 |
# File 'lib/pacman/arcade/scoreboard.rb', line 31 def reset_combo @next_ghost_bonus = FIRST_GHOST_BONUS end |