Commit e02b0cf5 by BellCodeEditor

auto save

parent 8f55bcf2
Showing with 3 additions and 2 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random import random
pygame.init() # 初始化 pygame.init() # 初始化
class Block(pygame.sprite.Sprite): class Block(pygame.sprite.Sprite):
def __init__(self,image1,image2,image3): def __init__(self,image1,image2,image3):
super().__init__() super().__init__()
self.image=random.choice([image1,image2,image3]) self.image=random.choice([image1,image2,image3])
self.rect=self.image.get_rect() self.rect=self.image.get_rect()
self.rect= 1000 self.rect.x = 1000
self.rect.y = 500 - self.rect.height self.rect.y = 500 - self.rect.height
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((1000, 600)) screen = pygame.display.set_mode((1000, 600))
...@@ -32,6 +31,8 @@ t = 30 ...@@ -32,6 +31,8 @@ t = 30
obstacle=Block(bush, stone, cacti) obstacle=Block(bush, stone, cacti)
road_x=0 road_x=0
background_x=0 background_x=0
time=0
block_list=pygame.sprite.Group()
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:
......
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