fix swap
This commit is contained in:
parent
97b687c085
commit
850aad353e
@ -230,8 +230,10 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
||||
font_name = FONT_NAME,
|
||||
anchor_x = 'right'
|
||||
)
|
||||
self.on_resize(WINDOW_WIDTH, WINDOW_HEIGHT)
|
||||
self.new_game()
|
||||
self.scale = 1
|
||||
|
||||
def on_hide(self):
|
||||
self.pause()
|
||||
|
||||
def on_resize(self, width, height):
|
||||
super().on_resize(width, height)
|
||||
@ -296,7 +298,7 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
||||
|
||||
def swap(self):
|
||||
super().swap()
|
||||
self.ghost = TetrominoSprites(self.ghost, self, GHOST_ALPHA)
|
||||
self.ghost.sprites = TetrominoSprites(self.ghost, self, GHOST_ALPHA)
|
||||
for tetromino in [self.held, self.current, self.ghost]:
|
||||
if tetromino:
|
||||
tetromino.sprites.update()
|
||||
@ -387,7 +389,7 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
||||
start_x = self.matrix_bg.center_x,
|
||||
start_y = self.matrix_bg.center_y,
|
||||
color = HIGHLIGHT_TEXT_COLOR,
|
||||
font_size = HIGHLIGHT_TEXT_SIZE,
|
||||
font_size = HIGHLIGHT_TEXT_SIZE * self.scale,
|
||||
align = 'center',
|
||||
font_name = FONT_NAME,
|
||||
anchor_x = 'center',
|
||||
|
@ -2,7 +2,7 @@
|
||||
import random
|
||||
|
||||
from .utils import Coord, Movement, Rotation, T_Spin, Line
|
||||
from .tetromino import Tetromino, T
|
||||
from .tetromino import Tetromino, T, I
|
||||
from .consts import (
|
||||
NB_LINES, NB_COLS, NB_NEXT,
|
||||
LOCK_DELAY, FALL_DELAY,
|
||||
@ -326,7 +326,7 @@ class TetrisLogic():
|
||||
self.current.prelocked = False
|
||||
self.stop(self.lock)
|
||||
self.current, self.held = self.held, self.current
|
||||
if self.held.__class__ == Tetromino.I:
|
||||
if type(self.held) == I:
|
||||
self.held.coord = HELD_I_COORD
|
||||
else:
|
||||
self.held.coord = HELD_COORD
|
||||
|
Loading…
x
Reference in New Issue
Block a user