Hi all, I am using the following code to move my player to the check point (after death, if the check point is cleared). That works fine, but then the player is stuck at the check point transform position. Any suggestions on how to get my player moving freely again after moving to the check point? Thanks!
void Start (){
if (checkPoint >= 1) {
gameObject.transform.position = currentCheckPoint.transform.position;
}
}
And...
public class CheckPointScript : MonoBehaviour {
void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.tag == "Player"){
MainScript myPlayer = (MainScript) GameObject.Find("Player").GetComponent("MainScript");
myPlayer.currentCheckPoint.transform.position = this.transform.position;
}
}
}