Commit ccd648a2 by BellCodeEditor

save project

parent 136270c3
Showing with 8 additions and 2 deletions
import pygame
from pygame import locals
from random import randint
pygame.init() # 初始化
score = 0
......@@ -17,7 +18,10 @@ background = pygame.image.load('bg.png')
font = pygame.font.Font('STKAITI.TTF', 60) # 字体
# 俄罗斯方块所有形状
O = [[(0, 0), (0, 1), (1, 0), (1, 1)]]
O = [[(0, 0), (0, 1), (1, 0), (1, 1)],
[(0, 0), (0, 1), (1, 0), (1, 1)],
[(0, 0), (0, 1), (1, 0), (1, 1)],
[(0, 0), (0, 1), (1, 0), (1, 1)]]
I = [[(0, -1), (0, 0), (0, 1), (0, 2)],
[(-1, 0), (0, 0), (1, 0), (2, 0)]]
Z = [[(0, -1), (0, 0), (1, 0), (1, 1)],
......@@ -45,7 +49,8 @@ cube_colors = [
(153, 0, 51), (204, 255, 102), (255, 153, 0)]
center = [2, 8] # 第2行第8列
current_shape = [(0, -1), (0, 0), (0, 1), (-1, 0)]
current_shape = shape_list[randint(0,6)][randint(0,3)]
color=cube_colors[randint(0,10)]
while True:
for event in pygame.event.get():
......@@ -61,6 +66,7 @@ while True:
elif event.key == locals.K_DOWN: # 向下
if center[0] < 25:
center[0] += 1
# 将背景图画上去
screen.blit(background, (0, 0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment