How to make Tetris figures go down using libgdx Eclipse? The figures themselves are rendered. But do not want to move down. How to write the right method?

Square[] shape = world.shape.getArray(); text = FactoryShape.setColor(shape[0].color); for (int i = 0; i < shape.length; i++) { batch.draw(text, shape[i].position.x, shape[i].position.y) } 

For example, if you specify shape [i] .position.y-- then the figure will go down, but it will not lock after a fall.

  • You need to get the coordinates of the bottom line of the space in which you draw shape [i] and compare y, when the coordinates match, stop the drop of this shape. Still most likely need to take into account the height of the figure. - Vyacheslav Mischenko pm
  • What about the next option? For example, when a figure falls on a figure? How is it to stop her? Create collisions? - Raziel Ravenous
  • Logically, the figures are made up of cubes. In order not to make unnecessary calculations - can first consider the dimensions of the figure and then - which side is it turned? Make the shape of the figure fixed. Rotated so much, only 4 states of the figure. It can be turned with only one side to the floor. Then you will need to take into account both the line of the floor and the figures lying on the floor. - Vyacheslav Mischenko

0