vendredi 4 décembre 2020

If I used random to choose the position of a turtle circle, how do I make sure they don't overlap

Here is my code for one circle. The screen has to be 500,500 and the circles have to be that size:

asteroid.pencolor('grey')
asteroid.fillcolor('grey')
asteroid.begin_fill()
asteroid.hideturtle()
asteroid.penup()
asteroid.speed(15)
asteroid.setposition(randint(-400,400), randint(-400,400))
asteroid.pendown()
asteroid.circle(35)
asteroid.end_fill()



Aucun commentaire:

Enregistrer un commentaire