class Player

Attributes

color[R]
x[RW]
y[RW]

Public Class Methods

new(x, y) click to toggle source
# File lib/player.rb, line 6
def initialize(x, y)
  @x = x
  @y = y
  @color = Gosu::Color::BLACK
  @data = nil
end

Public Instance Methods

height() click to toggle source
# File lib/player.rb, line 23
def height
  @data.size
end
is_brick(x, y) click to toggle source
# File lib/player.rb, line 13
def is_brick(x, y)
  raise 'Error player bounds' if x.negative? || x > width - 1 || y.negative? || y > height - 1

  @data[y][x] == 1
end
rotate() click to toggle source
# File lib/player.rb, line 27
def rotate
  @data = @data.reverse.transpose
end
rotate_rollback() click to toggle source
# File lib/player.rb, line 31
def rotate_rollback
  @data = @data.transpose.reverse
end
width() click to toggle source
# File lib/player.rb, line 19
def width
  @data[0].size
end