pygame中的背景不起作用

时间:2018-06-29 14:18:01

标签: python pygame

import pygame
import sys   
import os     

基本内容

'''
Objects
'''

# put Python classes and functions here

'''
Setup #...
'''
# put run-once code here


fps = 60
ani = 4
clock = pygame.time.Clock()
pygame.init()

我认为这可能是个问题:

在互联网上,我用.convert()看到了一些东西,但是它一直给我: AttributeError:“ str”对象没有属性“ convert”

当我尝试放入.conver()

已经搜索了2个小时,我找不到这个菜鸟的东西...

background = pygame.image.load(os.path.join('background.png'))
size = (width, height) = background.get_size() 

world = pygame.display.set_mode(size)

...

'''
Main Loop
'''

或此处:

world.blit(background, (0,0))

...

while main == True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit(); sys.exit()
            main = False

        if event.type == pygame.KEYDOWN:
            if event.key == ord('q'):
                pygame.quit()
                sys.exit()  
                main = False 

pygame.display.flip()
clock.tick(fps)

0 个答案:

没有答案