display controls on start and pause instead of play

This commit is contained in:
adrienmalin 2019-09-28 13:47:38 +02:00
parent cef8ac0541
commit dfbfb093e0
2 changed files with 46 additions and 36 deletions

View File

@ -32,33 +32,47 @@ TEXT_COLOR = arcade.color.BUBBLES
HIGHLIGHT_TEXT_COLOR = arcade.color.BUBBLES HIGHLIGHT_TEXT_COLOR = arcade.color.BUBBLES
FONT_NAME = "joystix monospace.ttf" FONT_NAME = "joystix monospace.ttf"
TEXT_MARGIN = 40 TEXT_MARGIN = 40
FONT_SIZE = 10 FONT_SIZE = 16
TEXT_HEIGHT = 20.8
HIGHLIGHT_TEXT_FONT_SIZE = 20 HIGHLIGHT_TEXT_FONT_SIZE = 20
TEXT_HEIGHT = 13.2 START_TEXT = """TETRARCADE
START_TEXT = """PRESS
[ENTER] CONTROLS
TO MOVE LEFT
START""" MOVE RIGHT
SOFT DROP
HARD DROP SPACE
ROTATE CLOCKWISE
ROTATE COUNTERCLOCKWISE Z
HOLD C
PAUSE ESC
PRESS [ENTER] TO START"""
STATS_TEXT = """SCORE STATS_TEXT = """SCORE
HIGH SCORE HIGH SCORE
TIME
LEVEL LEVEL
GOAL GOAL
LINES LINES
TIME
"""
PAUSE_TEXT = """TETRARCADE
CONTROLS
MOVE LEFT
MOVE RIGHT
SOFT DROP
HARD DROP SPACE
ROTATE CLOCKWISE
ROTATE COUNTERCLOCKWISE Z
HOLD C
RESUME ESC
PRESS [ESC] TO RESUME"""
MOVE LEFT
MOVE RIGHT
SOFT DROP
HARD DROP SPACE
ROTATE
CLOCKWISE
ROTATE Z
COUNTERCLOCKWISE
HOLD C
PAUSE ESC"""
GAME_OVER_TEXT = """GAME GAME_OVER_TEXT = """GAME
OVER OVER
@ -66,12 +80,6 @@ PRESS
[ENTER] [ENTER]
TO PLAY TO PLAY
AGAIN""" AGAIN"""
PAUSE_TEXT = """PAUSE
PRESS
[ESC]
TO
RESUME"""
# Sprites paths # Sprites paths
WINDOW_BG = "images/bg.jpg" WINDOW_BG = "images/bg.jpg"
@ -357,19 +365,21 @@ class TetrArcade(Tetris, arcade.Window):
t = time.localtime(self.time) t = time.localtime(self.time)
for y, text in enumerate( for y, text in enumerate(
( (
"{:02d}:{:02d}:{:02d}".format(
t.tm_hour-1, t.tm_min, t.tm_sec
),
"{:n}".format(self.nb_lines), "{:n}".format(self.nb_lines),
"{:n}".format(self.goal), "{:n}".format(self.goal),
"{:n}".format(self.level), "{:n}".format(self.level),
"{:02d}:{:02d}:{:02d}".format(t.tm_hour-1, t.tm_min, t.tm_sec),
"{:n}".format(self.high_score), "{:n}".format(self.high_score),
"{:n}".format(self.score) "{:n}".format(self.score)
), )
start=14
): ):
arcade.draw_text( arcade.draw_text(
text = text, text = text,
start_x = self.matrix_sprite.left - TEXT_MARGIN, start_x = self.matrix_sprite.left - TEXT_MARGIN,
start_y = self.matrix_sprite.bottom + y*TEXT_HEIGHT, start_y = self.matrix_sprite.bottom + 2*y*TEXT_HEIGHT,
color = TEXT_COLOR, color = TEXT_COLOR,
font_size = FONT_SIZE, font_size = FONT_SIZE,
align = 'right', align = 'right',

View File

@ -29,27 +29,27 @@ NEXT_PIECES_POSITIONS = [
for n in range(NB_NEXT_PIECES) for n in range(NB_NEXT_PIECES)
] ]
HELD_PIECE_POSITION = Coord(-7, NB_LINES-3) HELD_PIECE_POSITION = Coord(-7, NB_LINES-3)
HELD_I_POSITION = Coord(-5, NB_LINES-3) HELD_I_POSITION = Coord(-7, NB_LINES-3)
class Status: class Status:
STARTING = "starting" STARTING = "starting"
PLAYING = "playing" PLAYING = "playing"
PAUSED = "paused" PAUSED = "paused"
OVER = "over" OVER = "over"
class Movement: class Movement:
LEFT = Coord(-1, 0) LEFT = Coord(-1, 0)
RIGHT = Coord(1, 0) RIGHT = Coord( 1, 0)
DOWN = Coord(0, -1) DOWN = Coord( 0, -1)
class Rotation: class Rotation:
CLOCKWISE = -1 CLOCKWISE = -1
COUNTERCLOCKWISE = 1 COUNTERCLOCKWISE = 1