Suppose I have character surrounded by a cubic room.
My goal is to move that character to the opposite position of the room every time the character reaches one of the walls, roof and floor both included.
Like in the classical game "Asteroids" but with the Z axis included.
It's already possible to print the position by using a game property (string) attached to this module:
def update(cont):
own = cont.owner
own["pos"] = str([round(v) for v in own.worldPosition])
But how do I create the interval able to move the character object to the desired position?
There is a .blend prototype hosted HERE.
Addendum 1): There is another prototype that can be found here:
For this second prototype if you press only the W key continuously, the character will move to the opposite side as intended. But, how does one achieve this integration?
if obj.location.x > room.right.x: obj.localtion.x = room.left.x
$\endgroup$