My goal is to create a lot of polygon button. For example, if I input a number of 6, I want to have 6 polygons.
For example:
import pygame
pygame.init()
SIZE_X = SIZE_Y = 600
screen = pygame.display.set_mode((SIZE_X, SIZE_Y), pygame.RESIZABLE )
red = (255, 0 , 0)
NB_POLYGONS = 6
for i in range(NB_POLYGONS):
polygons = [ ( x1 + i * 50,y1) , ( x2 + i * 50,y2), ( x3 + i * 50,y3)]#With xn and yn some random cords
pygame.draw.polygon(screen,red, polygons)
This example works and creates 6 polygons. But how can I make them responsive? For example by clicking on one of them to switch it to blue. In the code I provided I've put 3 points in the polygon, but I want to know if it's possible to do this with an arbitrary polygon.