deqin - 小鸟管道2.0

    技术2024-05-27  104

    import pygame class bird: def __init__(self,window): self.x = 200 self.y = 353 self.skin = pygame.image.load("bird.png") self.window = window self.gravity = 1 def move_up(self): self.y -= 10 def show(self): self.window.blit(self.skin,(self.x,self.y)) import pygame import bird # 1。初始化 pygame.init() # 2。制作窗口 window = pygame.display.set_mode((401 ,706)) # 3。给一个标题 pygame.display.set_caption("管道小黑") # 导入图片 background = pygame.image.load('background.png') shadiao_bird = bird.bird(window) while True: # 电脑得识别玩家的操作 鼠标/键盘 for shi_jian in pygame.event.get(): print(shi_jian) if shi_jian.type == pygame.QUIT: pygame.quit() window.blit(background,(0,0)) shadiao_bird.show() pygame.display.update() pygame.quit()
    Processed: 0.013, SQL: 9