import pygame
import random
pygame.init()
sc = pygame.display.set_mode((1500, 800))
clock = pygame.time.Clock()
hp = 100
dl=0
dx=5
dy=5
ix=5
iy=5
plaerX, plaerY=750, 400
plaer = pygame.draw.rect(sc, (50, 50, 50), (plaerX, plaerY , 100, 100), 0)
image = pygame.image.load("foot-soldier-clipart-md.png")
image = pygame.transform.scale(image,(80,150))
imageX, imageY=plaerX, plaerY
vrag = pygame.image.load("roman-soldier-clipart-md.png")
class Enemy:
    def __init__(self):
        self.x = 1488
        self.y = random.randint(100, 700)
        self.size = 50
        self.speed = random.randint(3, 7)
    def move(self):
        self.x -=self.speed
    def draw(self):
        return pygame.draw.rect(sc, (210, 210, 210), [self.x, self.y, self.size, self.size])
enemies = [Enemy() for i in range(10)]

go=True
while go:
    dl+=5
    if hp<=0:
        go=False
    Keys = pygame.key.get_pressed()
    sc.fill((87, 88, 87))
    for e in enemies:
        e.move()
        enemy_rect = e.draw()
    #pygame.draw.rect(sc, (50, 50, 50), (plaerX, plaerY,100,100))
    if Keys[pygame.K_LEFT]:
        plaerX -= dx
    if Keys[pygame.K_RIGHT]:
        plaerX += dx
    if Keys[pygame.K_UP]:
        plaerY -= dy
    if Keys[pygame.K_DOWN]:
        plaerY += dy
    if Keys[pygame.K_LEFT]:
        imageX -= ix
    if Keys[pygame.K_RIGHT]:
        imageX += ix
    if Keys[pygame.K_UP]:
        imageY -= iy
    if Keys[pygame.K_DOWN]:
        imageY += iy
    if plaerX<=0:
        go=False

    sc.blit(image, (plaerX, plaerY))
    pygame.display.update()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            go = False
            pygame.quit()
    clock.tick(15)