das kannst du ca so machen: Code: int ortx; // Zielkoordinaten int orty; // int charx; // Event coordinaten int chary; // label1: charx = event.xposition; chary = event.yposition; if (charx < ortx){ move event (event, right); }elseif(charx > ortx){ move event (event, left); } charx = event.xposition; chary = event.yposition; if (chary < orty){ move event (event, down); }elseif(chary > ortY){ move event (event, up); } if ((charx == ortx) && (chary == orty)) { goto label2; } goto label1; } label2: hier läuft der char zwar direkt zur koordinate (näherungsweise luftlinie) aber du brauchst lediglich die zielcoordinaten angeben lassen^^
int ortx; // Zielkoordinaten int orty; // int charx; // Event coordinaten int chary; // label1: charx = event.xposition; chary = event.yposition; if (charx < ortx){ move event (event, right); }elseif(charx > ortx){ move event (event, left); } charx = event.xposition; chary = event.yposition; if (chary < orty){ move event (event, down); }elseif(chary > ortY){ move event (event, up); } if ((charx == ortx) && (chary == orty)) { goto label2; } goto label1; } label2:
--
Foren-Regeln