Commit 5f7015f0 by BellCodeEditor

save project

parent ad32a6b5
Showing with 14 additions and 2 deletions
import pygame
from pygame import locals
import random
pygame.init() # 初始化
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600))
......@@ -21,6 +21,10 @@ index = 0
y = 400
r = "running"
t = 30
fd = random.choice([apple,stone,cacti])
e = fd.get_rect()
e.x = 1000
e.y = 500-e.height
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -46,10 +50,17 @@ while True:
index+=1
if index == 4:
index = 0
Wukong=hero[index]
if e.x < 0-e.width:
fd = random.choice([apple,stone,cacti])
e = fd.get_rect()
e.x = 1000
e.y = 500-e.height
Wukong=hero[index]
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(Wukong, (150, y))
e.x -= 20
screen.blit(fd, (e.x, e.y))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
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