I am new to Python and using Zelle's graphics to create a game. I need the two while loops below to run at the same time, however I am running into difficulty. I tried nesting the while loops but then the horses and civilians would only move if the mouse was clicked, which I don't want. What I want is for the horses and civilians to always be moving, and the princess to move only when the mouse is clicked, and stop the game with a "game over" when she has saved 10 civilians.
# animation loop.
while True==True:
for horse in horseList:
if horse.leg.getX() > -187:
horse.move( -1, 20 )
else:
horse.move( 5, 28 )
for civilian in civiliansList:
if civilian.getX() < 800:
civilian.move( 20, 0 )
else:
civilian.move( -100, 0 )
while civiliansSaved != 10:
mouse = win.getMouse()
princess.move( mouse, civilianCounter)
civilianCounter = princess.move( mouse, civilianCounter)
# move is a method that will return an updated civilianCounter ( it is initially 0 and defined outside of the while loop ), depending on whether princess runs into civilians
else:
print( "Game over" )
win.getMouse()
win.close()