+ 1
Im having some kind of mistake on my code that im making
Basically im making a game with pygame and as you can see by the code its only the beginning. But for some reason everything that i write past exit() comes as : code is unreachable. I am writing this code on pycharm. import pygame from sys import exit pygame.init() gjer = 1200 gjat = 700 ek = pygame.display.set_mode((gjer, gjat)) ora = pygame.time.Clock() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() exit() screen.fill('black') pygame.display.update() ora.tick(60)
9 odpowiedzi
+ 1
The problem is that everything after "exit()" is also after an infinite loop - "while true". So will never be reached indeed.
Maybe you have to review the block structure. When did you expect these lines to run?
0
Follow the easy way bro...
Just simply import sys and
Write sys.exit() in ur code.
0
Oh i have done and still its the same problem
0
Try removing pygame.quit()
And only use sys.exit().
0
I have done that too
i feel like it has to be a problem with pycharm
0
I think u have some indention errors in last lines of code...
Try changing them...
If it doesnt work even then..
Pycharm in ur device has problem
0
I see... Well thank u
0
Its okay i fixed it. I should only have done in the beginning
a= true
While a
...
...
...
0
Okay this was a mistake. Killing myself is my only option now.