Commit 5e618b4c by BellCodeEditor

save project

parent 13fb4abb
Showing with 9 additions and 6 deletions
import pygame
from pygame import locals,display,init
from pygame import event as _event
from pygame.time import Clock as TIME
from pygame.image import load
from pygame.sprite import *
from pygame.sprite import Sprite,Group,collide_rect
from random import choice,randint
init() # 初始化
......@@ -56,7 +57,7 @@ block_list = Group()
game_state = True
while True:
for event in pygame.event.get():
for event in _event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
......@@ -66,12 +67,11 @@ while True:
jumpState = "up"
# 悟空造型
wukong = Player(hero[index])
if game_state:
if jumpState == "runing": # 跑步状态下
index += 1
if index >= 5:
index = 0
if game_state == True:
pass
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
......@@ -109,6 +109,10 @@ while True:
screen.blit(sprite.image,(sprite.rect.x,sprite.rect.y))
if sprite.rect.x <= 0-sprite.rect.width:
sprite.kill()
if collide_rect(wukong,sprite):
screen.blit(gameover,(400,200))
game_state = False
# 刷新画面
display.update()
TIME().tick()
\ No newline at end of file
{"第1名": 0, "第2名": 0, "第3名": 0}
\ No newline at end of file
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