-
Notifications
You must be signed in to change notification settings - Fork 6
/
circle.py
41 lines (32 loc) · 835 Bytes
/
circle.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
36
37
38
39
40
41
# Defining a circular array attempt
import pygame
import numpy as np
pygame.init()
#colors
white = (255,255,255)
black = (0,0,0)
red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)
gameDisplay = pygame.display.set_mode((800,600))
gameDisplay.fill(black)
# block settings
l = 15
b = 15
#circle
w = np.linspace(0.0, 360.0, num=100)
r = 200
offset = 300
x = [ r*np.cos(i) for i in w]
y = [ r*np.sin(i) for i in w]
for i in range(len(x)):
pygame.draw.rect(gameDisplay, red, (x[i]+offset+l ,y[i]+offset+b,l,b))
pygame.draw.rect(gameDisplay, red, (0,0,l,b))
pygame.draw.rect(gameDisplay, green, (800-l,600-b,l,b))
#pygame.draw.circle(gameDisplay, white, (150,150), 75)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
pygame.display.update()