Commit 7ef98edc by BellCodeEditor

auto save

parent 81dc4c9a
Showing with 3 additions and 2 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random import random
gamestate = True
pygame.init() # 初始化 pygame.init() # 初始化
# 创建一个窗口 # 创建一个窗口
class Block(pygame.sprite.Sprite): class Block(pygame.sprite.Sprite):
...@@ -54,7 +54,7 @@ while True: ...@@ -54,7 +54,7 @@ while True:
if jumpState == "runing": if jumpState == "runing":
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState = "up" jumpState = "up"
if gamestate== True:
if jumpState == "up": # 起跳状态 if jumpState == "up": # 起跳状态
if t > 0: if t > 0:
y -= t y -= t
...@@ -110,6 +110,7 @@ while True: ...@@ -110,6 +110,7 @@ while True:
if pygame.sprite.collide_rect(wukong,sprite): if pygame.sprite.collide_rect(wukong,sprite):
gameover=pygame.image.load('gameover.png') gameover=pygame.image.load('gameover.png')
screen.blit(gameover,(400,200)) screen.blit(gameover,(400,200))
gamestate=False
pygame.display.update() 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