Class: Pacman::GhostsController

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

Overview

handles behaviour of ghosts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level) ⇒ GhostsController

Returns a new instance of GhostsController.



4
5
6
7
# File 'lib/pacman/ghosts_controller.rb', line 4

def initialize(level)
  @level = level
  @colission = false
end

Instance Attribute Details

#colissionObject

Returns the value of attribute colission.



19
20
21
# File 'lib/pacman/ghosts_controller.rb', line 19

def colission
  @colission
end

Instance Method Details

#updateObject



9
10
11
12
13
14
15
16
17
# File 'lib/pacman/ghosts_controller.rb', line 9

def update
  @level.ghosts_frozen -= 1 unless (@level.ghosts_frozen == 0)
  return unless (@level.ghosts_frozen == 0)

  update_blinky ||
  update_pinky ||
  update_inky ||
  update_clyde
end