Commit eebd00e4 by BellCodeEditor

save project

parent 349f0c91
Showing with 44 additions and 4 deletions
import pygame
from pygame import locals
pygame.init()
score = 0
grid_size = 20
grid_num_width = 15
grid_num_height = 25
FPS = 30
screen = pygame.display.set_mode((460,500))
pygame.display.set_caption("俄罗斯方块")
clock = pygame.time.Clock()
background = pygame.image.load("background.png")
font = pygame.font.Font("STKAITI.TTF",60)
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
screen.blit(background,(0,0))
pygame.draw.rect(screen,(255,0,0),(140,20,20,20),0)
pygame.draw.rect(screen,(255,255,255),(140,20,20,20),1)
score_text = font.render(str(score),True,(0,0,0))
screen.blit(score_text,(350,70))
pygame.display.update()
clock.tick(FPS)
...@@ -14,7 +14,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮 ...@@ -14,7 +14,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
music_list = [] music_list = []
path = "C:\\Users\\Administrator\\Desktop\\tast" path =os.path.join("C:\\Users\\玛酷\\Desktop","mi")
filelist = os.listdir(path) filelist = os.listdir(path)
num = -1 num = -1
for i in filelist: for i in filelist:
...@@ -81,9 +81,11 @@ while True: ...@@ -81,9 +81,11 @@ while True:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-1:
num = 0 num = 0
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(os.path.join(path. music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
newRect=nem_logo.get_rect(center(320,200))
pos = (newRect[0]).newRect[i]
angle += 1 angle += 1
screen.blit(bg_img, (0, 0)) screen.blit(bg_img, (0, 0))
screen.blit(play_button, (270, 330)) screen.blit(play_button, (270, 330))
...@@ -91,4 +93,7 @@ while True: ...@@ -91,4 +93,7 @@ while True:
screen.blit(last_img, (120, 350)) screen.blit(last_img, (120, 350))
screen.blit(next_img, (420, 350)) screen.blit(next_img, (420, 350))
pygame.display.update() pygame.display.update()
\ No newline at end of file FPS.tick(60)
print()
\ No newline at end of file
import json
jsonData = '{"第一名":122,"第二名":109,"第三名":88}'
text = json.loads(jsonData)
print("第一名",text["第一名"])
print("第二名",text["第二名"])
print("第三名",text["第三名"])
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