所以我有这个错误 pygame.error: font not initialized 我已经厌倦了通过缩进它来修复它,未识别它,更改字体和其他东西但它仍然无法在我的 STARTMENUE 上工作。我也尝试过使用另一种字体,认为这是问题所在,但事实并非如此。
我有问题吗
largeText = pygame.font.Font('freesansblod.ttf',115)
我的完整代码
import pygame
#set screen
window = pygame.display.set_mode((500,500))
#set Name
pygame.display.set_caption("Noob")
class Player:
def __init__(self,x,y,height,width,color):
self.x = x
self.y = y
self.height = height
self.color = color
self.speed = 0
self.isJump = False
self.JumpCount = 10
self.fall = 0
self.rect = pygame.Rect(x,y,height,width)
def draw(self):
self.topleft = (self.x,self.y)
class Floor:
def __init__ (self,x,y,height,width,color):
self.x = x
self.y = y
self.height = height
self.width = width
self.color = color
self.rect = pygame.Rect(x,y,height,width)
def draw(self):
self.topleft = (self.x,self.y)
pygame.draw.rect(window,self.color,self.rect)
class Coin():
def __init__(self,x,y,height,width,color):
self.x = x
self.y = y
self.width = width
self.height = height
self.color = color
self.rect = pygame.Rect(x,y,height,width)
def draw(self):
self.topleft = (self.x,self.y)
self.draw.rect(self.color,self.rect)
white = (255,255,255)
green = (0,200,0)
red = (255,0,0)
drakred = (200,0,0)
darkgreen = (0,200,0)
black = (0,0,0)
player1 = Player(50,400,40,40,white)
coin = Coin(100,300,30,30,red)
floor1 = Floor(0,400,600,30,green)
fps = (30)
clock = pygame.time.Clock()
天涯尽头无女友
相关分类