0
ちょっと私は、コード内の混乱を減らすために関数内のpygameイベントを呼び出そうとしています。しかし、私はグローバル変数のエラーのためにプロセスを実行することができません。どんな助けもありがとう。Pygame関数の変数へのアクセス
from pygame.locals import *
import pygame, sys
def color():
screen.fill((85,163,48))
def events():
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
if event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
print "left"
#sets the game map variables
tilesize = 100
map_width = 600
map_height = 300
#initialises the game screen setting it up with the game map variables
pygame.init()
screen = pygame.display.set_mode((map_width,map_height))
while True:
color()
events()
pygame.display.update()
コードが正しくインデントされていないので、修正するのが最初のことになります。それを超えて、私たちにあなたの特定のエラーを教えてもらえますか? – Natecat