Hi everybody,I’m newbie. When Player die to show in Respawn Point.
I have 3 Spawn Point A,B,C in difference locate Map.
However, I want to player jump in to Spawn Point A jump over Spawn Point B in the same Level. Spawn Point B (over)---------> Spawn Point C (over)---------> Spawn Point A and More !
Please help me !Thanks. Who have example about it !
hmm… im not really sure what your asking, but if you want the player to go to a different spawn point in that order when you die you will need to do something like this -
have some variables to store the x y and z co-ordinates of the spawnpoints, a variable to count the times your player has died - have a small script like this:
if (deaths = 1)
{
transform.position = Vector3(variable 1, variable 2, variable 3);
}
do the same for deaths = 1, deaths = 2 and deaths = 3, but have the variables change to the co-ordinates of the next spawnpoint each time the character dies.
hope this helped, and that you can understand
try asking in your own language if your struggling.
Love from ><>FreakFish<><
thank your answer ! I search example Teleport on Youtube .
I need a tutorial or script about it !
Thanks !!!
Hi, welcome to the forum!
A good way to set up spawn points is to place empty GameObjects in the scene at the right positions. Then, in your respawn script, create an array of type GameObject:-
var spawnPoints: GameObject[];
You should be able to see the array in the inspector and fill it up by dragging the spawn point objects into the array variable. If you want to pick a spawn point at random each time, use:-
var chosenPoint = spawnPoints[Random.Range(0, spawnPoints.Length)];
If you want to cycle through the points, use:-
var spawnIndex: int; // Public var declared at top of script.
...
var chosenPoint = spawnPoints[spawnIndex];
var spawnIndex = (spawnIndex + 1) % spawnPoints.Length;