in

moving circles in groups at a time pygame


so i’ve been working on this project for a long time, and i have finally finished the second last step to complete this project. What my project does is it draws a spirograph using pygame, then moves all of the circles away from its original place and stops at the borders of the window. There is a catch, though. The catch is that i have to move all of the circles one group at a time, based on their color. So basically, since there are 5 circles per color, i want to move all of the 5 circles of a color at once. Then, when the first group of circles is done moving, continue on to the next color, and move all 5 of those circles in the group at once, etc, etc, starting at red, then moving all the blue circles at once, then moving all of the green circles at once, etc.
So far, i have only managed to move ALL of the circles at once, not the each 5 circles per color. Is there any way to do this? Please help me. I really want to finish this. This is my current code:

import time
import pygame
import math
import sys

# setting colors
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
ORANGE = (255, 127, 0)
YELLOW = (255, 255, 0)
PURPLE = (160, 32, 240)
# setting what order the colors go in
listCircleColor = (RED, BLUE, GREEN, ORANGE, YELLOW, PURPLE, WHITE)
# how many circles per color
intGroup = 5
# the space between each circle
turnangle = 360 / 35
# width of screen
width = 600
# height of screen
height = 600
# radius of circles
radius = 100
# making the screen
screen = pygame.display.set_mode((width, height))
# if the code is running, then continue
running = True
clock = pygame.time.Clock()

##.draw.circle(screen, BLUE, (0, 0), radius, width=2)
alpha = turnangle
circles = []
# draw
alpha = turnangle
for i in range(intGroup):
    for cl in listCircleColor:
        if alpha > 0 and alpha < 90:
            x = 300 + radius * math.cos(math.radians(alpha))
            y = 300 + radius * math.sin(math.radians(alpha))
            pygame.draw.circle(screen, cl, (x, y), radius, width=2)
            # second quarter of circles
        if alpha > 90 and alpha < 180:
            x = 300 - radius * math.cos(math.radians(180 - alpha))
            y = 300 + radius * math.sin(math.radians(180 - alpha))
            pygame.draw.circle(screen, cl, (x, y), radius, width=2)
            # third quarter of circles
        if alpha > 180 and alpha < 270:
            x = 300 - radius * math.cos(math.radians(alpha - 180))
            y = 300 - radius * math.sin(math.radians(alpha - 180))
            pygame.draw.circle(screen, cl, (x, y), radius, width=2)
            # last quarter of circles
        if alpha > 270 and alpha < 360:
            x = 300 + radius * math.cos(math.radians(360 - alpha))
            y = 300 - radius * math.sin(math.radians(360 - alpha))
            pygame.draw.circle(screen, cl, (x, y), radius, width=2)

        circles.append(([x, y], cl, alpha))
        alpha = alpha + turnangle
        pygame.display.update()
        clock.tick(10)
        #circle = [pygame.draw.circle(screen, cl, (300 + radius * math.cos(math.radians(alpha)), 300 + radius * math.sin(math.radians(alpha))), radius, width=2)]
        #circles = {'circles': circle.get_rect()}

# move"
trangleedge = radius
movetimes = 1
time.sleep(2)



# exit only when user clicks on exit button
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            exit()
    screen.fill((0, 0, 0))
    while movetimes <= 100:
        trangleedge = trangleedge + 1
        for circle in circles:
            #x = circle[0][0]
            #y = circle[0][1]
            alpha = circle[2]
            cl = circle[1]

            if alpha > 0 and alpha < 90:
                x = 300 + trangleedge * math.cos(math.radians(alpha))
                y = 300 + trangleedge * math.sin(math.radians(alpha))
                #pygame.draw.circle(screen, cl, (x, y), radius, width=2)
                # second quarter of circles
            if alpha > 90 and alpha < 180:
                x = 300 - trangleedge * math.cos(math.radians(180 - alpha))
                y = 300 + trangleedge * math.sin(math.radians(180 - alpha))
                #pygame.draw.circle(screen, cl, (x, y), radius, width=2)
                # third quarter of circles
            if alpha > 180 and alpha < 270:
                x = 300 - trangleedge * math.cos(math.radians(alpha - 180))
                y = 300 - trangleedge * math.sin(math.radians(alpha - 180))
                #pygame.draw.circle(screen, cl, (x, y), radius, width=2)
                # last quarter of circles
            if alpha > 270 and alpha < 360:
                x = 300 + trangleedge * math.cos(math.radians(360 - alpha))
                y = 300 - trangleedge * math.sin(math.radians(360 - alpha))
                #pygame.draw.circle(screen, cl, (x, y), radius, width=2)

            circle[0][0] = x
            circle[0][1] = y
            screen.fill((0, 0, 0))
            for center, color, alpha in circles:
                pygame.draw.circle(screen, color, center, radius, 2)

            pygame.display.flip()
        clock.tick(60)
        movetimes += 1



Source: https://stackoverflow.com/questions/70629599/moving-circles-in-groups-at-a-time-pygame

CCI Goes After Google Again for Allegedly Abusing Dominant Position

A game to test programming and logical skills