Class: ShapeO
Overview
- ][
- ][
Instance Attribute Summary
Attributes inherited from Shape
#blocks, #falling, #rotation, #x, #y
Instance Method Summary collapse
-
#get_blocks ⇒ Object
updates shape position and returns its blocks.
-
#initialize(game) ⇒ ShapeO
constructor
A new instance of ShapeO.
Methods inherited from Shape
#collides?, #collides_with_blocks?, #collides_with_walls?, #draw, #falling?, #maximum_x_block, #maximum_y_block, #minimum_x_block, #move_x, #move_y, #rotate, #translate_by_y, #update, #update_move_x, #update_move_y
Constructor Details
#initialize(game) ⇒ ShapeO
Returns a new instance of ShapeO.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/shapeO.rb', line 7 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) @rotations = 1 @blocks.each do |block| block.color = 0xFF00FF00 end end |
Instance Method Details
#get_blocks ⇒ Object
updates shape position and returns its blocks
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/shapeO.rb', line 23 def get_blocks @blocks[0].x = @x @blocks[1].x = @x + Block.width @blocks[2].x = @x @blocks[3].x = @x + Block.width @blocks[0].y = @y @blocks[1].y = @y @blocks[2].y = @blocks[0].y + Block.height @blocks[3].y = @blocks[1].y + Block.height @blocks end |