hey again guys! Since you are all so kind to me I’m going to ask here again:
So basically I have a script that resets the position of the player, if the player falls down from a platform.
The script says, if the player falls down from the platform then transform the position of the player to the start area (0,0,0).
Like so: else if(transform.position.y < -4){ reset position }
But I’m having trouble on my second level. Because the second level is in the same scene but is just moved a lot to the right (x axis) on the screen (so you can’t see it from lvl 1).
I thought this script would work, but it just doesn’t. Could you help me out guys?
else if(transform.position.y < -4 && transform.position.x > 100){
transform.position.y = 0; //set the y axis that the player will spawn to
transform.position.x = 120; // set the x axis that the player will spawn to
transform.position.z = 0; // set the z axis that the player will spawn to
rigidbody.velocity = Vector3.zero;
}
As you can see, I tried to do it like this: if the player is below the platforms AND is 100 units to the right, THEN reset the position to level 2 starting area.
Help please