Commit 8ca7ec04 by BellCodeEditor

save project

parent ffec4fde
Showing with 12 additions and 5 deletions
import pygame
from pygame import locals
import random
D=0
F=0
pygame.init() # 初始化
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600))
......@@ -58,8 +59,14 @@ while True:
if index >= 5:
index = 0
# 将背景图画上去
screen.blit(background, (0, 0)) # 远处背景
screen.blit(road, (0, 500)) # 路
F-=2
if F<=-1000:
F=0
screen.blit(background, (F, 0))
D-=8
if D<=-1000:
D=0 # 远处背景
screen.blit(road, (D, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
if rect.x <= 0-rect.width: # 障碍物消失
......@@ -72,4 +79,4 @@ while True:
screen.blit(obstacle, (rect.x, rect.y))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
FPS.tick(20)
\ 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