dimanche 25 septembre 2022

How to have 3 random objects spawn on 3 places

The goal is having random objects spawn on 3 positions once . the code works and looks like this but with more if statements and 3 small stataments:

if mainloop != 3:
  if smallloop1 != 1:
     if randomnumber == x:
        object.goto(x, y)
        mainloop += 1
        smallloop += 1

the problem is that the if statement doesnt stop so multiple objects spawn
im also not getting any error messages
I tried changing the if statements to while loops which didnt change anything except having to stop them with the break command or using a list instead of a random number which made the thing more complicated and again didnt change anything
Thanks in advance




Aucun commentaire:

Enregistrer un commentaire