- Joined
- Dec 3, 2022
- Messages
- 1
- Reaction score
- 0
I was coding Space Invaders when I got the message TypeError: Ship.draw() missing 1 required positional argument: 'window'
My code is as follows:
I can't seem to figure out why it is saying this any help would be appreciated
My code is as follows:
Python:
class Ship:
def _init_(self, x, y, health=100):
self.x = x
self.y = y
self.health = health
self.ship_img = None
self.laser_img = RED_LASER
self.laser = []
self,cool_down_counter = 0
def draw(self, window):
pygame.draw.rect(window, (255,0,0),(self.x, self.y, 50, 50),0)
def main():
run = True
FPS = 60
level = 1
lives = 5
clock = pygame.time.Clock()
main_font = pygame.font.SysFont("comicsans", 25)
ship = Ship()
def redraw_window():
WIN.blit(BG, (0,0))
#draw text
lives_label = main_font.render(f"Lives: {lives}", 1, (255,255,255))
level_label = main_font.render(f"Level: {level}", 1, (255,255,255))
WIN.blit(lives_label, (10, 10))
WIN.blit(level_label, (650, 10))
Ship.draw(WIN)
I can't seem to figure out why it is saying this any help would be appreciated