Verfasst: Montag 16. Mai 2005, 13:04
nu versteh ich das gar nicht mehr
ich hab das ganze nu komplett geändert. Jetzt hab ich nur noch ne while schleife, die bei einem Mausklick die funktion mausklick aufruft und als parameter die koordinaten der maus übergibt der gleiche fehler wie viorher bleibt
die while schleife:
und die funktion mauskilck:
wäre nett, wenn mir jemand helfen kann
ich hab das ganze nu komplett geändert. Jetzt hab ich nur noch ne while schleife, die bei einem Mausklick die funktion mausklick aufruft und als parameter die koordinaten der maus übergibt der gleiche fehler wie viorher bleibt
die while schleife:
Code: Alles auswählen
while 1:
if pygame.event.get([MOUSEBUTTONDOWN]):
mausklick(pygame.mouse.get_pos()[0], pygame.mouse.get_pos()[1])
Code: Alles auswählen
def mausklick(mausx, mausy):
for i in planeten.keys(): #bei einem Klick auf einen Planeten soll etwas passieren
if planeten[i]["besitzer"] == aktuell["spieler"]:
planetkoordy = planeten[i]["koordy"]
planetkoordx = planeten[i]["koordx"]
if (pygame.mouse.get_pos()[0] > planetkoordx and pygame.mouse.get_pos()[0] < planetkoordx+29 and pygame.mouse.get_pos()[1] > planetkoordy and pygame.mouse.get_pos()[1] < planetkoordy+29) :
if aktuell["aktion"]=="startausw":
aktuell["neueaktion"]={"startplani":i}
aktuell["aktion"]="zielausw"
if planeten[i]["besitzer"] != aktuell["spieler"]:
planetkoordy = planeten[i]["koordy"]
planetkoordx = planeten[i]["koordx"]
if (pygame.mouse.get_pos()[0] > planetkoordx and pygame.mouse.get_pos()[0] < planetkoordx+29 and pygame.mouse.get_pos()[1] > planetkoordy and pygame.mouse.get_pos()[1] < planetkoordy+29) :
if aktuell["aktion"]=="zielausw":
aktuell["neueaktion"]["zielplani"]=i
aktuell["aktion"]="ende"
elif aktuell["aktion"]=="ende":
beendeturn()