diff options
Diffstat (limited to 'Assets/Scripts/RespawnPoint.cs')
-rw-r--r-- | Assets/Scripts/RespawnPoint.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Assets/Scripts/RespawnPoint.cs b/Assets/Scripts/RespawnPoint.cs new file mode 100644 index 0000000..6396128 --- /dev/null +++ b/Assets/Scripts/RespawnPoint.cs @@ -0,0 +1,18 @@ +using MontanaJohns.Actors; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class RespawnPoint : MonoBehaviour +{ + [SerializeField] private Sprite activatedSprite; + + private void OnTriggerEnter2D(Collider2D collision) + { + if (collision.gameObject.tag == "Player") + { + collision.gameObject.GetComponent<Player>().spawnPoint = transform.position; + gameObject.GetComponent<SpriteRenderer>().sprite = activatedSprite; + } + } +} |