hoping for some insight.
I'm new to python and programming and am using a game design tutorial to start getting the feel for the language. I'm on Windows 10, using anaconda & spyder. The tutorial is using IDLE but my university recommends spyder so I wanted to get used to that environment. The code below is the same as the tutorial however when I run it there is no display window generated. The console does not throw any errors. I'm having trouble finding a solution through a google search so any help is greatly appreciated, thanks in advance!
EDIT: The (now fixed) indentation error pointed out by some users was due to me improperly formatting the code here, in spyder my indentation was correct.
UPDATE: I was able to get the display window to launch by opening a new console and closing the current one. Not sure why that worked if someone can explain it, it would be most appreciated. However, now when I exit out of the display by clicking the X the following error is thrown in the console:
_crossy_game_master_file.py", line 39, in quit()
NameError: name 'quit' is not defined
If anyone has any insight as to the cause of, and solution to, this error I would appreciate it. Thank you.
import pygame
pygame.init()
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 800
SCREEN_TITLE = 'Crossy RPG'
WHITE_COLOR = (255,255,255)
BLACK_COLOR = (0,0,0)
clock = pygame.time.Clock()
TICK_RATE = 60
is_game_over = False
game_screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))
game_screen.fill(WHITE_COLOR)
pygame.display.set_caption(SCREEN_TITLE)
while not is_game_over:
for event in pygame.event.get():
if event.type == pygame.QUIT:
is_game_over = True
pygame.display.update()
clock.tick(TICK_RATE)
pygame.quit()
quit()