一个错误,我的游戏画面显示不出

这是我的一个游戏,大家帮我看看我有没有错误,如果有大佬看出问题并指点,本人感之不尽
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()

最佳答案

我是不是没有吧这些东西画到屏幕上

1年前 评论
Jason990420 1年前
讨论数量: 9
Jason990420
  1. 代码格式错误, 缩格不对, 请参考以下内容, 再重新编辑内容.

代码高亮

```python

你的代码

```

  1. 代码错误 - You can find the full exception information in console window.
screen.bilt(textimg1,(x+radius/2-20,y-radians/2))

screen.bilt

AttributeError: ‘pygame.Surface’ object has no attribute ‘bilt’.

Should be screen.blit and there’re lot of palces with this problem.

radians

NameError: name radians is not defined.

Should be radius.

start_angle = math.radius(0)

math.radius

AttributeError: module ‘math’ has no attribute ‘radius’

Should be math.radians

pygame.deaw.arc(screen,color,position,start_angle,end_angle,width)

pygame.deaw.arc

AttributeError: module ‘pygame’ has no attribute ‘deaw’

Should be pygame.draw.arc

screen.blit(piece1,piece2,piece4,piece3)

TypeError: argument 1 must be pygame.Surface, not bool

blit(…) method of pygame.Surface instance

blit(source, dest, area=None, special_flags=0) -> Rect

draw one image onto another

Post you script before you checked there’s no syntax error or exception.

1年前 评论

pygame.display.set_caption (‘pie 游戏’):引号错误。其他还有很多。。。

找一个文本编辑器,会有代码错误提示。

1年前 评论

但是我这里没有任何报错

1年前 评论
Jason990420 1年前

没有办法,我自学的,而且我的书还是参考2015年的python书来写的

1年前 评论

好的 我看看 感谢

1年前 评论

我是不是没有吧这些东西画到屏幕上

1年前 评论
Jason990420 1年前

感谢大家的讨论我似乎找到了问题所在

1年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!