Class: ShapeI
Overview
Instance Attribute Summary
Attributes inherited from Shape
#blocks, #falling, #rotation, #x, #y
Instance Method Summary collapse
- #get_blocks ⇒ Object
-
#initialize(game) ⇒ ShapeI
constructor
A new instance of ShapeI.
Methods inherited from Shape
#collides?, #collides_with_blocks?, #collides_with_walls?, #draw, #falling?, #maximum_x_block, #maximum_y_block, #minimum_x_block, #rotate, #shape_to_array, #translate_by_y, #update, #update_move_x, #update_move_y
Constructor Details
#initialize(game) ⇒ ShapeI
Returns a new instance of ShapeI.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/shapeI.rb', line 9 def initialize(game) super(game) @blocks[0] = Block.new(game) @blocks[1] = Block.new(game) @blocks[2] = Block.new(game) @blocks[3] = Block.new(game) @rotation_block = @blocks[1] @rotations = 2 @blocks.each do |block| block.color = 0xFFFF0000 end end |
Instance Method Details
#get_blocks ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/shapeI.rb', line 25 def get_blocks @blocks[0].x = @x @blocks[1].x = @x @blocks[2].x = @x @blocks[3].x = @x @blocks[0].y = @y @blocks[1].y = @blocks[0].y + Block.height @blocks[2].y = @blocks[1].y + Block.height @blocks[3].y = @blocks[2].y + Block.height rotate @blocks end |