added and positioned an array of 8 knobs

This commit is contained in:
SallarShayegan
2025-02-23 20:46:34 +01:00
parent e80152716b
commit 1e0d5de886
2 changed files with 21 additions and 6 deletions

19
main.py
View File

@ -6,7 +6,20 @@ pygame.init()
screenW = 561
screenH = 325
screen = pygame.display.set_mode((screenW, screenH))
knob1 = Knob(screen)
knobs_radius = screenW / 25
knobs_spacing = knobs_radius * 2
knobs_x = (screenW - (knobs_radius + knobs_spacing) * 2) / 2
x = knobs_x
knobs_y = (screenH - (knobs_radius + knobs_spacing) * 3) / 2
y = knobs_y
knobs = []
for i in range(8):
knobs.append(Knob(screen, (0, 210, 200), knobs_radius, (x, y)))
y += knobs_radius + knobs_spacing
if i == 3 or i == 6:
x += knobs_radius + knobs_spacing
y = knobs_y
clock = pygame.time.Clock()
running = True
@ -22,8 +35,10 @@ while running:
screen.fill("black")
# RENDER YOUR GAME HERE
knob1.display()
for i in range(8):
knobs[i].display()
pygame.draw.polygon(screen, "white", [(0, screenH/2), (screenW*3/19, screenH), (0, screenH)])
# flip() the display to put your work on screen
pygame.display.flip()