Class: Pitchcar::Pieces::Start

Inherits:
Straight show all
Defined in:
lib/pieces/start.rb

Constant Summary collapse

IMAGE =
Magick::Image.read(File.expand_path('../images/start_tile.png', __FILE__))[0]

Constants inherited from Piece

Piece::DIRECTIONS

Instance Attribute Summary

Attributes inherited from Piece

#direction, #type, #x, #y

Instance Method Summary collapse

Methods inherited from Straight

#next_coordinate, #next_direction

Methods inherited from Piece

#coordinate, first_from_string, #initialize, #name, #to_h, type_from_string

Constructor Details

This class inherits a constructor from Pitchcar::Pieces::Piece

Instance Method Details

#imageObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/pieces/start.rb', line 6

def image
  if north?
    IMAGE.rotate(270)
  elsif east?
    IMAGE
  elsif west?
    IMAGE.rotate(180)
  elsif south?
    IMAGE.rotate(90)
  end
end

#to_sObject



18
19
20
# File 'lib/pieces/start.rb', line 18

def to_s
  'St'
end