Class: Pacman::Ghost

Inherits:
AnimatedObject show all
Defined in:
lib/pacman/ghost.rb

Overview

model of ghost

Direct Known Subclasses

BlinkyGhost, ClydeGhost, InkyGhost, PinkyGhost

Instance Attribute Summary collapse

Attributes inherited from AnimatedObject

#animation_index

Instance Method Summary collapse

Constructor Details

#initialize(x, y, direction) ⇒ Ghost

Returns a new instance of Ghost.



4
5
6
7
8
9
# File 'lib/pacman/ghost.rb', line 4

def initialize(x, y, direction)
  super()
  @x, @y = x, y
  @direction = direction
  @stopped = false # used for slow ghost
end

Instance Attribute Details

#directionObject

Returns the value of attribute direction.



11
12
13
# File 'lib/pacman/ghost.rb', line 11

def direction
  @direction
end

#stoppedObject

Returns the value of attribute stopped.



11
12
13
# File 'lib/pacman/ghost.rb', line 11

def stopped
  @stopped
end

#xObject

Returns the value of attribute x.



11
12
13
# File 'lib/pacman/ghost.rb', line 11

def x
  @x
end

#yObject

Returns the value of attribute y.



11
12
13
# File 'lib/pacman/ghost.rb', line 11

def y
  @y
end