Commit c7c9cba7 by BellCodeEditor

save project

parent a73f3e43
Showing with 9 additions and 41 deletions
import pygame
from pygame import locals
import random
pygame.init() # 初始化
# 创建一个窗口
......@@ -17,6 +18,10 @@ hero1 = pygame.image.load('hero2.png')
hero2 = pygame.image.load('hero3.png')
hero3 = pygame.image.load('hero4.png')
hero4 = pygame.image.load('hero5.png')
rondomNum = random.choice([stone,cacti,apple])
rondomRect = rondomNum.get_rect()
rondomRect.x = 1000
rondomRect.y = 500-rondomRect.height
modeList = [hero,hero1,hero2,hero3,hero4]
index = 0
y=400
......@@ -35,7 +40,7 @@ while True:
if event.key == locals.K_SPACE:
status="up"
if status=="up":
if y =30:
if y >150:
y -=5
else:
status="down"
......@@ -50,6 +55,9 @@ while True:
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong, (150, y))
rondomRect.x-=8
screen.blit(rondomNum,(rondomRect.x,rondomRect.y))
# 刷新画面
pygame.display.update()
FPS.tick(20)
......@@ -57,43 +65,3 @@ while True:
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