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