Update terminis.py
This commit is contained in:
parent
b105796618
commit
5ee8426d12
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import curses
|
import curses
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -11,12 +12,14 @@ pip install --user windows-curses"""
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
curses.COLOR_ORANGE = 8
|
curses.COLOR_ORANGE = 8
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import sched
|
import sched
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import locale
|
import locale
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import configparser
|
import configparser
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -103,6 +106,7 @@ class Tetromino:
|
|||||||
for mino_position in self.minoes_position
|
for mino_position in self.minoes_position
|
||||||
):
|
):
|
||||||
self.position = potential_position
|
self.position = potential_position
|
||||||
|
if lock:
|
||||||
self.postpone_lock()
|
self.postpone_lock()
|
||||||
self.rotated_last = False
|
self.rotated_last = False
|
||||||
self.matrix.refresh()
|
self.matrix.refresh()
|
||||||
@ -660,6 +664,7 @@ class Game:
|
|||||||
self.matrix.refresh(paused=True)
|
self.matrix.refresh(paused=True)
|
||||||
self.next.refresh(paused=True)
|
self.next.refresh(paused=True)
|
||||||
self.scr.timeout(-1)
|
self.scr.timeout(-1)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
key = self.scr.getkey()
|
key = self.scr.getkey()
|
||||||
if key == self.controls["QUIT"]:
|
if key == self.controls["QUIT"]:
|
||||||
@ -679,11 +684,13 @@ class Game:
|
|||||||
self.matrix.piece.fall_timer = scheduler.cancel(self.matrix.piece.fall_timer)
|
self.matrix.piece.fall_timer = scheduler.cancel(self.matrix.piece.fall_timer)
|
||||||
if self.matrix.piece.lock_timer:
|
if self.matrix.piece.lock_timer:
|
||||||
self.matrix.piece.lock_timer = scheduler.cancel(self.matrix.piece.lock_timer)
|
self.matrix.piece.lock_timer = scheduler.cancel(self.matrix.piece.lock_timer)
|
||||||
|
|
||||||
self.matrix.piece, self.hold.piece = self.hold.piece, self.matrix.piece
|
self.matrix.piece, self.hold.piece = self.hold.piece, self.matrix.piece
|
||||||
self.hold.piece.position = self.hold.PIECE_POSITION
|
self.hold.piece.position = self.hold.PIECE_POSITION
|
||||||
self.hold.piece.minoes_positions = self.hold.piece.MINOES_POSITIONS
|
self.hold.piece.minoes_positions = self.hold.piece.MINOES_POSITIONS
|
||||||
self.hold.piece.hold_enabled = False
|
self.hold.piece.hold_enabled = False
|
||||||
self.hold.refresh()
|
self.hold.refresh()
|
||||||
|
|
||||||
if self.matrix.piece:
|
if self.matrix.piece:
|
||||||
self.start_piece()
|
self.start_piece()
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user