一个错误,我的游戏画面显示不出
这是我的一个游戏,大家帮我看看我有没有错误,如果有大佬看出问题并指点,本人感之不尽
import math
import pygame,sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((1600,850))
pygame.display.set_caption(‘pie游戏’)
font = pygame.font.Font(None,60)
color = 200,80,60
width = 4
x = 800
y = 425
radius = 200
position = x-radius,y-radius,radius2,radius2
piece1 = False
piece2 = False
piece3 = False
piece4 = False
while True:
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
elif event.type == KEYUP:
if event.key == pygame.K_ESCAPE:
sys.exit()
elif event.key == pygame.K_1:
piece1 = True
elif event.key == pygame.K_2:
piece2 = True
elif event.key == pygame.K_3:
piece3 = True
elif event.key == pygame.K_4:
piece4 = True
screen.fill((0,0,200))
textimg1 = font.render(‘1’,True,color)
screen.bilt(textimg1,(x+radius/2-20,y-radians/2))
textimg2 = font.render(‘2’,True,color)
screen.bilt(textimg2,(x-radius/2,y-radius/2))
textimg3 = font.render(‘3’,True,color)
screen.bilt(textimg3,(x-radius/2,y-radius/2-20))
textimg4 = font.render(‘4’,True,color)
screen.bilt(textimg4,(x+radius/2-20,y+radius/2-20))
if piece1:
start_angle = math.radius(0)
end_angle = math.radius(90)
pygame.draw.arc(screen,color,position,start_angle,end_angle,width)
pygame.draw.line(screen,color,(x,y),(x,y-radius),width)
pygame.draw.line(screen,color,(x,y),(x+radius,y),width)
if piece2:
start_angle = math.radius(90)
end_angle = math.radius(180)
pygame.deaw.arc(screen,color,position,start_angle,end_angle,width)
pygame.draw.line(screen,color,(x,y),(x,y-radius),width)
pygame.draw.line(screen,color,(x,y),(x+radius,y),width)
if piece3:
start_angle = math.radius(180)
end_angle = math.radius(270)
pygame.draw.arc(screen,color,position,start_angle,end_angle,width)
pygame.draw.line(screen,color,(x,y),(x,y-radius,y),width)
pygame.draw.line(screen,color,(x,y),(x-radius,y),width)
if piece4:
start_angle = math.radius(270)
end_angle = math.radius(360)
pygame.deaw.arc(screen,color,position,start_angle,end_angle,width)
pygame.draw.line(screen,color,(x,y),(x,y-radius),width)
pygame.draw.line(screen,color,(x,y),(y,x+radius),width)
if piece1 and piece2 and piece3 and piece4:
color = 0,225,0
screen.blit(piece1,piece2,piece4,piece3)
pygame.display.flip()
推荐文章: