Commit 338bba90 by BellCodeEditor

save project

parent d0f3448c
Showing with 9 additions and 8 deletions
......@@ -2,6 +2,7 @@ import pygame
from pygame import locals
import random
pygame.init() # 初始化
group = pygame.sprite.Group()
class Books(pygame.sprite.Sprite):
def __init__(self,image1,image2,image3):
super().__init__()
......@@ -24,16 +25,16 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
#变量
index = 0
y = 400
t = 35
road_x = 0
beijing_x = 0
time = 0
jump = "running"
#rect = cacti.get_rect()
#rect.x = 1000
#rect.y = 455 - rect.width
obstacle=Books(stone,cacti,apple)
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -76,11 +77,11 @@ while True:
screen.blit(road, (road_x, 500))
screen.blit(wukong, (150, y))
#障碍物
if obstacle.rect.x < 0-obstacle.rect.width:
obstacle = Books(stone,cacti,apple)
else:
obstacle.rect.x -= 8
screen.blit(obstacle.image,(obstacle.rect.x, obstacle.rect.y))
#if obstacle.rect.x < 0-obstacle.rect.width:
# obstacle = Books(stone,cacti,apple)
#else:
# obstacle.rect.x -= 8
#screen.blit(obstacle.image,(obstacle.rect.x, obstacle.rect.y))
# 刷新画面
pygame.display.update()
......
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