-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAula4_4.py
35 lines (30 loc) · 943 Bytes
/
Aula4_4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pygame, sys
from pygame.locals import *
import math
import numpy as np
pygame.init()
DISPLAYSURF = pygame.display.set_mode((400,300))
WHITE=(255,255,255)
ang=np.pi
posicao=0
while True: #Main loop--
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RIGHT:
ang=ang+np.pi/10
if event.key == pygame.K_LEFT:
ang=ang-np.pi/10
DISPLAYSURF.fill((0,0,0))
inicio_linha=(200,300)
#end_line=CENTRO_LINHA+v_linha
#print(end_line)
raio=100
x = math.sin(ang)*raio
y = math.cos(ang)*raio
fim_linha=np.add(inicio_linha, [x,y])
pygame.draw.circle( DISPLAYSURF, WHITE, [200,300], 100,1)
pygame.draw.line(DISPLAYSURF, WHITE, inicio_linha, fim_linha, 2)
pygame.display.update()