I want to make my rectangle when it collides with any of the elements of the lists so it makes it return to its position and take life. But the only thing that detects me are the last elements. How can I fix it?
coord_listArriba=[]
x1=0
y1=0
coord_listLado=[]
x2=0
y2=0
velEnemys=3
for i in range(3):
x1=randint(100,700)
y1+=100
coord_listArriba.append([x1,y1])
for i in range(3):
x2+=100
y2=randint(100,700)
coord_listLado.append([x2,y2])
---------------------------------------------------------------------------------------
for j in coord_listArriba:#j=[10,100]
x1=j[1]#10
y1=j[0]#100
enemyup=pygame.draw.circle(screen, cafe, (x1,y1), 25)
j[0]+=velEnemys#j=[13,300]
if j[0]>800:
j[0]=10
j[1]=randint(100,700)
for e in coord_listLado:#j=[10,100]
x2=e[0]#10
y2=e[1]#100
enemyleft=pygame.draw.circle(screen, rojo, (x2,y2), 25)
e[0]-=velEnemys
if e[0]<0:
e[0]=800
e[1]=randint(75,475)
--------------------------------------------------------------------------------
jugador1=pygame.draw.rect(screen,negro,(jugador1_x,jugador1_y,15,20))
if jugador1.colliderect(enemyup) or jugador1.colliderect(enemyleft):
jugador1_x=50
jugador1_y=220
vidas-=1