Class: ShapeT
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) ⇒ ShapeT
constructor
A new instance of ShapeT.
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) ⇒ ShapeT
Returns a new instance of ShapeT.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/shapeT.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 = 4 @blocks.each do |block| block.color = 0xFF00FFFF end end |
Instance Method Details
#get_blocks ⇒ Object
updates shape position and returns its blocks
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/shapeT.rb', line 25 def get_blocks @blocks[0].x = @x @blocks[1].x = @x + Block.width @blocks[2].x = @blocks[1].x + Block.width @blocks[3].x = @x + Block.width @blocks[0].y = @y @blocks[1].y = @y @blocks[2].y = @y @blocks[3].y = @y + Block.height rotate @blocks end |