I am using visual studio code and I am practicing the book python crash course but when I run the code it give me three problem. I made screen print to show my problem clearly
- 1- Too many positional argument for function call pylint
- 2- (function) run_game NotReturn
- 3- TypeError check – events() take 0 positional argument but 1 was given
import sys
import pygame
from settings import Settings
from ship import Ship
import game_functions as gf
def run_game():
#initialize game and create a screen object.
ai_settings = Settings()
screen = pygame.display.set_mode((ai_settings.screen_width,
ai_settings.screen_height))
pygame.display.set_mode((1200, 800))
pygame.display.set_caption("Alein Invasion")
#Make a ship.
ship= Ship(screen)
#set the background color.
bgcolor=(230,230,230)
#start the main loop for the game.
while True:
gf.check_events(ship)
ship.update()
gf.update_screen(ai_settings,screen,ship)
#Redraw the screen during each pass through the loop.
screen.fill(ai_settings.bg_color)
ship.blitme()
#make the most recently drawn screen visible.
pygame.display.flip()
run_game()
Output:
line 27, in <module>
run_game()
File
"c:\Users\naema\OneDrive\Desktop\python_work\alien_invasion.py",
line 18, in run_game
gf.check_events(ship)
TypeError: check_events() takes 0 positional arguments but 1 was given
PS C:\Users\naema\OneDrive\Desktop\python_work>enter code here