小编Sil*_*ire的帖子

Pygame字体错误

所以我决定开始制作一个游戏而我正在测试它然后我收到了这个错误:

Traceback (most recent call last):
  File "TheAviGame.py", line 15, in <module>
    font = pygame.font.Font(None,25)
pygame.error: font not initialized
Run Code Online (Sandbox Code Playgroud)

我不知道到目前为止我做错了什么......代码:

#!/usr/bin/python
import pygame
blue = (25,25,112)
black = (0,0,0)
red = (255,0,0)
white = (255,255,255)
groundcolor = (139,69,19)
gameDisplay = pygame.display.set_mode((1336,768))
pygame.display.set_caption("TheAviGame")
direction = 'none'
clock = pygame.time.Clock()
img = pygame.image.load('player.bmp')
imgx = 1000
imgy = 100
font = pygame.font.Font(None,25)
def mts(text, textcolor, x, y):
    text = font.render(text, True, textcolor)
    gamedisplay.blit(text, [x,y])
def gameloop():
    while True:
        for event in pygame.event.get(): …
Run Code Online (Sandbox Code Playgroud)

python fonts pygame

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

fonts ×1

pygame ×1

python ×1