mercredi 29 septembre 2021

Creating windows that spawn in random locations on a building in Python Turtle

I have a function called draw_object that I want to draw skyscrapers and within that function I want there to be windows that will be created within the bounds of that skyscraper.

Since I want the skyscraper in many locations I thought the best idea for the windows would be to have them spawn in random locations based upon where the skyscraper is.

Here is the code I have no far:

def draw_object(x,y):
    draw_rectangle(t1,x,y,1,"black","gray",60,40)
    draw_rectangle(t1,randint(x,y),randint(y,),1,"yellow","yellow",5,5)



Aucun commentaire:

Enregistrer un commentaire