Class: ShapeS
Overview
-
- ][
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Shape
#blocks, #falling, #rotation, #x, #y
Instance Method Summary collapse
- #get_blocks ⇒ Object
-
#initialize(game) ⇒ ShapeS
constructor
A new instance of ShapeS.
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) ⇒ ShapeS
Returns a new instance of ShapeS.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/shapeS.rb', line 8 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 = 0xFFFFFF00 end end |
Instance Method Details
#get_blocks ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/shapeS.rb', line 24 def get_blocks @blocks[0].x = @x @blocks[1].x = @x @blocks[2].x = @x + Block.width @blocks[3].x = @x + Block.width @blocks[0].y = @y @blocks[1].y = @blocks[0].y + Block.height @blocks[2].y = @blocks[0].y + Block.height @blocks[3].y = @blocks[2].y + Block.height rotate @blocks end |