Professional Documents
Culture Documents
Before making the code for transferring over to a new stage, there are some changes for the player
score script:
void OnTriggerEnter2D(Collider2D trig)
{
if (trig.gameObject.tag == "endlevel")
{
CountScore();
timeLeft = 120;
}
if (trig.gameObject.tag == "coin")
{
playerScore += 10;
Destroy(trig.gameObject);
}
As soon as they hit the endlevel the time will be set back to 120 and score will be
counted.
Prepare two images to be used as spawn point. Add box collider on them and be sure to
tick the isTrigger.
spA
sp1 = spA
sp2 = spB
spB
sp1 = spB
sp2 = spA