Feb-07-2022, 12:41 AM
Hi, I am not sure why when I go and run my code I am getting these two errors:
Terminal Output:
"File "c:\Users\Timothy Han\Documents\Python Projects\Pygame\PygameForBeginners-main\Assets\Two_Player_Space_Shooter.py", line 18, in <module>
main()
File "c:\Users\Timothy Han\Documents\Python Projects\Pygame\PygameForBeginners-main\Assets\Two_Player_Space_Shooter.py", line 12, in main
if event.type == pygame.QUIT():
TypeError: 'int' object is not callable"
Also, the game window immediately opens and closes for some reason. I know that I set my while loop to 'True' until the player closes or exits out the game window. However, the game window automatically closes by itself real fast for some reason. Not sure why is that. Any suggestions or help would be greatly appreciated! Thanks!
Terminal Output:
"File "c:\Users\Timothy Han\Documents\Python Projects\Pygame\PygameForBeginners-main\Assets\Two_Player_Space_Shooter.py", line 18, in <module>
main()
File "c:\Users\Timothy Han\Documents\Python Projects\Pygame\PygameForBeginners-main\Assets\Two_Player_Space_Shooter.py", line 12, in main
if event.type == pygame.QUIT():
TypeError: 'int' object is not callable"
Also, the game window immediately opens and closes for some reason. I know that I set my while loop to 'True' until the player closes or exits out the game window. However, the game window automatically closes by itself real fast for some reason. Not sure why is that. Any suggestions or help would be greatly appreciated! Thanks!
import pygame WIDTH, HEIGHT = 900, 500 WIN = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("First Pygame!") def main(): done = True while done: for event in pygame.event.get(): if event.type == pygame.QUIT(): done = False pygame.quit() if __name__ == "__main__": main()