I'm fairly new to python. I'm writing a code for a simple alien invasion game but I'm getting this error.
import sys
import pygame
from settings import Settings
from ship import Ship
import game_functions as gf
def run_game():
pygame.init()
ai_settings = Settings()
screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height))
pygame.display.set_caption("Game")
ship = Ship(screen)
bg_color = (230, 230, 230)
while True:
gf.check_events(ship)
ship.update()
gf.update_screen(ai_settings, screen, ship)
for event in pygame.event.get():
if event.type==pygame.QUIT():
sys.exit()
screen.fill(ai_settings.bg_color)
ship.blitme()
pygame.display.flip()
run_game()
I'm aware that I'm accidentally calling some integer value but I have no clue where I'm going wrong.
I have also checked these lines
File "C:/Users/Areeb Irfan/.PyCharmCE2018.3/config/scratches/AlienGame.py", line 25, in run_game()
File "C:/Users/Areeb Irfan/.PyCharmCE2018.3/config/scratches/AlienGame.py", line 16, in run_game gf.check_events(ship)
File "C:\Users\Areeb Irfan.PyCharmCE2018.3\config\scratches\game_functions.py", line 5, in check_events if event.type==pygame.QUIT():
TypeError: 'int' object is not callable
()pygame.QUITis integer value, not function. You can't use()withpygame.QUITevent.type==pygame.QUIT()withevent.type==pygame.QUIT