Commit 4b658832 by BellCodeEditor

auto save

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