Commit 2f452e3a by BellCodeEditor

save project

parent c6fb50b3
Showing with 15 additions and 2 deletions
import pygame
import random
from pygame import locals
pygame.init() # 初始化
......@@ -18,6 +19,12 @@ t=30
y=400
zhuangTai="running"
wokanbudong=random.choice([stone,cacti,apple])
rect=wokanbudong.get_rect()
rect.x=1000
rect.y=500-rect.height
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -42,8 +49,12 @@ while True:
zhuangTai="running"
t=30
if rect.x <0-rect.width:
wokanbudong=random.choice([stone,cacti,apple])
rect=wokanbudong.get_rect()
rect.x=1000
rect.y=500-rect.height
rect.x-=15
# 接收到退出事件后退出程序
......@@ -57,6 +68,7 @@ while True:
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong, (150, y))
screen.blit(wokanbudong,(rect.x,rect.y))
# 刷新画面
pygame.display.update()
FPS.tick(40)
\ 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