Essentially, what is happening is that every other attempt to load my main game file, the kernel crashes. I'm not sure what the problem is exactly (because I'm not getting any feedback pointing to an error), but since I have begun incorporating a font into my game, the kernel has been crashing regularly.
I have commented out all the code pertaining to rendering and initializing the font, and the kernel and game I am working on runs great. I primarily use Spyder if that's relevant.
import pygame
pygame.font.init()
class Player(object):
font = pygame.font.SysFont('Arial', 15)
text = [font.render('Cricket', True, (0, 0, 0)),
font.render('ATK', True, (0, 0, 0)),
font.render('MG', True, (0, 0, 0)),
font.render('', True, (255, 255, 255)),
font.render('', True, (255, 255, 255))]
def __init__(self):
blah blah
def display_UI(self, _display_surf):
pygame.draw.rect(_display_surf, self.ui_display_color, (self.ui_rect))
_display_surf.blit(self.text[0], (128, 12))
_display_surf.blit(self.text[1], (128, 48))
_display_surf.blit(self.health_bar[self.health_count], (self.health_bar_x, self.health_bar_y))
Somewhere in here is essentially where the problem is, or at least I would imagine so, unless there's a problem with updating a library, but I'm really not sure because I have had no feedback.
I'm hoping this is an easy fix, but I really have no idea what's going on. Like I said, every other time, my main game file which I have imported this class to, runs fine, renders the font, and no errors are found. Other times, the error "Kernel died, restarting" happens. Thanks for any and all feedback.