I want my object (Man) to move not only left and right but up and down as well. This has to happen randomly. I did it with move() and with setLocation( getX(), getY()+1). It works but I want them to move in the other direction when they are atWorldEdge. How can I do this without the turn( ) command? Because if I set the turn angle for example 180° then the object moves upside down in the other direction. But a Man walking upside down looks weird. I want him to move like mirrored in the other direction.
Ich hab ein Objekt (Mann), welches ich sich nicht nur zufällig nach rechts und links, sondern auch nach oben und unten bewegen soll. Dies hab ich mit den Befehlen move() und setLocation( getX(), getY()+1) gemacht. Wen er sich nun am Rand der Welt umdrehen soll, kann er das ja mit turn(). Wenn ich den Winkel aber dann z.B. auf 180 Grad setze, geht der Mann dann aber auf dem Kopf stehend in die andere Richtung. Wie schaffe ich es, dass er das nicht tut, sondern sozusagen normal in die andere Richtung geht? Sozusagen sich spiegelverkehrt bewegt.

