Classified3939 fe27385b7f
Adding SPACE INVASION files
(these were created on a local copy, now added to this fork in order to make a pull request)
2023-10-06 21:45:25 -06:00

18 lines
540 B
Python

'''
This file contains the Enemy class which represents the enemy spaceships.
'''
import pygame
class Enemy:
def __init__(self, x, y):
self.x = x
self.y = y
self.width = 64
self.height = 64
self.speed = 2
def update(self):
self.y += self.speed
# Reverse direction if enemy reaches screen bounds
if self.y > 600:
self.y = 0
def draw(self, screen):
pygame.draw.rect(screen, (255, 0, 0), (self.x, self.y, self.width, self.height))