import pygame
pygame.init()
screen = pygame.display.set_mode([600, 400])
clock = pygame.time.Clock()
FPS = 500
radius = 10
running = True
x = 300
y = 200
while running:
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
radius = radius + 5
if event.type == pygame.QUIT:
running = False
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
x -= 1
if keys[pygame.K_RIGHT]:
x += 1
if keys[pygame.K_UP]:
y -= 1
if keys[pygame.K_DOWN]:
y += 1
if (x < 0): x = 600
if (x > 600): x = 0
if (y < 0): y = 400
if (y > 400): y = 0
screen.fill((255,255,255))
pygame.draw.circle(screen, (0, 0, 0), (x,y), radius)
pygame.display.update()
clock.tick(FPS)
pygame.quit()
|