Class: GamesAndRpgParadise::Tetris::ShapeI

Inherits:
Shape
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/gui/gosu/tetris/shape_i.rb

Instance Attribute Summary

Attributes inherited from Shape

#rotation

Instance Method Summary collapse

Methods inherited from Shape

#apply_rotation, #collide, #draw, #get_bounds, #needs_fall_update?, #needs_move_update?, #reset_internal_variables, #reverse, #update

Constructor Details

#initialize(game) ⇒ ShapeI

#

initialize

#


20
21
22
23
24
# File 'lib/games_and_rpg_paradise/gui/gosu/tetris/shape_i.rb', line 20

def initialize(game)
  super(game)
  @rotation_block = @blocks[1]
  reset
end

Instance Method Details

#get_blocksObject

#

get_blocks

#


36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/games_and_rpg_paradise/gui/gosu/tetris/shape_i.rb', line 36

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 + @blocks[0].height
  @blocks[2].y = @blocks[1].y + @blocks[1].height
  @blocks[3].y = @blocks[2].y + @blocks[2].height
  apply_rotation
  @blocks.each { |block| block.color = 0xffb2ffff }
end

#resetObject

#

reset

#


29
30
31
# File 'lib/games_and_rpg_paradise/gui/gosu/tetris/shape_i.rb', line 29

def reset
  @rotation_cycle = 2
end