examples/pending/netris/src/grid.rb
# When the piece is done falling, build up block
When the piece is done falling, build up block
When the piece is done falling build up block
def build_blocks
    new_blocks = []
    current_rotated_blocks.each do |block|
      block_actor = @stage.create_actor :block,
                                        x: block[0] * BLOCK_SIZE + @falling_piece.x,
                                        y: block[1] * BLOCK_SIZE + @falling_piece.y,
                                        grid_offset_x: block[0],
                                        grid_offset_y: block[1],
                                        image: @falling_piece.image
      new_blocks << block_actor
    end
    @falling_piece.remove
    new_blocks
  end
def build_blocks new_blocks = [ ] current_rotated_blocks . each do | block | block_actor = @stage . create_actor :block , x : block [ 0 ] * BLOCK_SIZE + @falling_piece . x , y : block [ 1 ] * BLOCK_SIZE + @falling_piece . y , grid_offset_x : block [ 0 ] , grid_offset_y : block [ 1 ] , image : @falling_piece . image new_blocks << block_actor end @falling_piece . remove new_blocks end
When the piece is done falling, build up block
When the piece is done falling build up block
# Destroy ourselves, leaving only the blocks behind