I am working on a 2d game and I have a helicopter that starts off screen and then moves across the screen. Once the copter gets off the screen I need it to loop around in a new random position that appears in the screen. This obviously gives the illusion that there are many enemies. Can someone help me with the script for this?
Thanks!
You can set the transform.position back to the orignal position with a different Y value once the object is off screen. Example is when your object is moving from left to right with a total screen width of 20 units camera centered on 0,0
if (transform.position.x > 10)
{
transform.position = new Vector2(-10,2);
}
If the original y was 0 then the new one can be 2. That would give the illusion that it’s a different game object.