-
Asteroids-like “Screen Wrap” effect?
I have the “throw” expression on the x position parameter of a layer, and I’m trying to modify it to return to 0 after it goes past a certain point, like the asteroids in Asteroids. AE is fine with this code, but the layer just keeps going off to the right, never to be seen again. What am I missing? Is the value of x not being updated with the current position on every frame, is it not getting reset to 0, or is there a problem with using only one of the values from position?
Thanks in advance…
veloc = 300; //horizontal velocity (pixels per second)
x = position[0];
if (x > 500) {
x = 0;
} else {
x = position[0] + (time - inPoint) *veloc;
}
x