Commit 4b658832 by BellCodeEditor

auto save

parent 209cc334
Showing with 67 additions and 5 deletions
......@@ -2,7 +2,7 @@ import pygame
from pygame import locals
import random
bg=pygame.display.set_mode(1000,600)
bg=pygame.display.set_mode((1000,600))
pygame.display.set_caption("悟空酷跑")
background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路
......@@ -43,15 +43,77 @@ lu.x=0
bg_x=0
gamestate= True
jingling_list=pygame.sprite.Group()
my_font=pygame.font.Font('STKAITI.TTF',18)
'''my_font=pygame.font.Font('STKAITI.TTF',18)'''
while True:
for event in pygame.event.get(): #检测如果按下退出,就结束
if event.type == locals.QUIT:
exit()
if event.type == locals KEYDOWN:
if event.key == K_up:
if jumpstate == "up":
y-=t
t-2
if t<=0:
jumpstate="down"
if jumpstate == "down":
y+=t
t+2
if t>=30:
jumpstate="run"
bg_x-=8 #背景向左移动,到屏幕边缘返回原点
screen.blit(background,(0,0))
if bg_x<-1000:
screen.blit(background,(bg_x,0))
if bg_x<=1000:
bg_x=0
lu_x-=8
screen.blit(rode,(lu_x,200))
if lu_x<=1000:
lu_x=0
obstacle.rect.x-=8
screen.blit(obstacle,(obstacle.rect.x,200))
......@@ -67,7 +129,7 @@ while True:
screen.blit(aa.image, (aa.rect.x, aa.rect.y))
# 刷新画面
pygame.display.update()
FPS.tick(60)
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