import pygame
import random
import math
pygame.init()
win = pygame.display.set_mode((500,500))
pygame.display.set_caption("")
angle = 0
angleStep = 10
x = 250
y = 250
run = True
while run:
pygame.time.delay(100)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
pygame.image.save(win, "image.jpg")
angle+=5
x1 = x + math.cos(math.radians(angle)) * 50;
y1 = y + math.sin(math.radians(angle)) * 50;
angle += angleStep;
x2 = x - math.cos(math.radians(angle)) * 50;
y2 = y - math.sin(math.radians(angle)) * 50;
pygame.draw.line(win,(255,255,255), [x1, y1], [x2, y2], 1)
pygame.display.update()
if (angle == 360):
angle = 0
y = y + 10
pygame.quit()
|