from pygame import *
from pygame.locals import *
import random
import pyc

C1_GREEN = (204, 255, 204)
C1_BLUE = (153, 204, 255)

size = width,height = 700,500
screen = display.set_mode(size)
bgColor = C1_BLUE
screen.fill(bgColor)

pos1 = [0,0,50,50]
pos2 = [0,0,50,50]
pos2[0] = random.randint(0, 650)
pos2[1] = random.randint(0, 450)

clock = time.Clock()
init()
distance = 1

running = True
while running:
    clock.tick(60)
    for p_event in event.get():
        if p_event.type == QUIT:
            running = False
        if p_event.type == KEYDOWN:
            if p_event.key == K_ESCAPE:
                running = False
    event.pump()
    keys = key.get_pressed()

    if keys[ord('s')]:
        if pos1[1] >= height - pos1[3]:
            pos1[1] = height - pos1[3]
        else:
            pos1[1] += distance

    elif keys[ord('w')]:
        if pos1[1] <= 0:
            pos1[1] = 0
        else:
            pos1[1] -= distance

    elif keys[ord('a')]:
        if pos1[0] <= 0:
            pos1[0] = 0
        else:
            pos1[0] -= distance

    elif keys[ord('d')]:
        if pos1[0] >= width- pos1[2]:
            pos1[0] = width - pos1[2]
        else:
            pos1[0] += distance

    elif keys[ord('q')]:
        distance = 10

    elif keys[ord('e')]:
        distance = 1

    screen.fill(bgColor)
    #draw.rect(screen, pyc.BLUE, pos1)
    draw.ellipse(screen, pyc.BLUE, pos2)
    draw.ellipse(screen, pyc.RED, pos1)

    display.update()
    if pos1[0] == pos2[0] and pos1[1] == pos2[1] :
        pos2[0] = random.randint(0, 650)
        pos2[1] = random.randint(0, 450)

quit()