import pygame

pygame.init()
clock=pygame.time.Clock()
import random
x=0
y=0
x1, y1=800,0

sc = pygame.display.set_mode((800,600))
pygame.display.set_caption("MyGame")

class Enemy:
    def __init__(self):
        self.x = random.randint(100, 700)
        self.y = random.randint(100, 500)
        self.size= 50
        self.speed = random.randint(3, 7)
        self.dir = random.randint(1, 4)
        self.timer = 0

    def move(self):
        self.timer += 1
        if self.timer > 30
            self.dir = random.randint(1, 4)
            self.timer = 0

    if self.dir == 1:
















tic = -20
go = True
while go:
    tic+=1
    if tic ==151:
        tic=0
    plaer = pygame.Rect(x, y, 50, 50)


    sc.fill((255,150,0))

    pygame.draw.rect(sc, (0, 150, 255), plaer)  # Игрок
    #pygame.draw.rect(sc,(0,0,255),vrag)      #Враг
    if x1<=-100:
        x1= 800
        y1= random.randint(0,500)
    x1-=20







    Keys = pygame.key.get_pressed()
    if Keys[pygame.K_LEFT] and x>=0:
        x-=10
    Keys = pygame.key.get_pressed()
    if Keys[pygame.K_RIGHT]and x<=750:
        x += 10

    Keys = pygame.key.get_pressed()
    if Keys[pygame.K_UP] and y>=0:
        y -= 10
    Keys = pygame.key.get_pressed()
    if Keys[pygame.K_DOWN] and y<=550:
        y += 10

    print (tic)
    pygame.display.update()
    clock.tick(30)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            go = False