tetris
allow more time before the next block when on ground
| -rw-r--r-- | Tetris.gd | 11 | ||||
| -rw-r--r-- | TetrisPiece.gd | 1 |
2 files changed, 8 insertions, 4 deletions
@@ -120,10 +120,13 @@ func tick(create_timer := true): if not current_shape.move(Vector2(0, 1), matrix): # invalid move: cant go down if current_shape.position.y == 0: get_tree().reload_current_scene() - current_shape.embed(matrix) - current_shape = TetrisPiece.new(Vector2(randi() % (COLUMNS - 4), 0)) - Logic.clear_lines(matrix) - print(ascii(matrix)) + if current_shape.stopped: + print(ascii(matrix)) + current_shape.embed(matrix) + current_shape = TetrisPiece.new(Vector2(randi() % (COLUMNS - 4), 0)) + Logic.clear_lines(matrix) + else: + current_shape.stopped = true draw_board() diff --git a/TetrisPiece.gd b/TetrisPiece.gd index cb1da80..584ac8f 100644 --- a/TetrisPiece.gd +++ b/TetrisPiece.gd @@ -4,6 +4,7 @@ class_name TetrisPiece var shape_type: int var shape := [] var position: Vector2 +var stopped := false func _init(pos: Vector2) -> void: |