aboutsummaryrefslogtreecommitdiffstats
path: root/Assets/Scripts/RespawnPoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/RespawnPoint.cs')
-rw-r--r--Assets/Scripts/RespawnPoint.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Assets/Scripts/RespawnPoint.cs b/Assets/Scripts/RespawnPoint.cs
index b45ece1..2a1e52e 100644
--- a/Assets/Scripts/RespawnPoint.cs
+++ b/Assets/Scripts/RespawnPoint.cs
@@ -8,6 +8,7 @@ public class RespawnPoint : MonoBehaviour
[SerializeField] private Sprite activatedSprite;
private AudioManager _audio;
+ private bool activated;
private void Start()
{
@@ -16,8 +17,9 @@ public class RespawnPoint : MonoBehaviour
private void OnTriggerEnter2D(Collider2D collision)
{
- if (collision.gameObject.tag == "Player")
+ if (collision.gameObject.tag == "Player" && !activated)
{
+ activated = true;
collision.gameObject.GetComponent<Player>().spawnPoint = transform.position;
gameObject.GetComponent<SpriteRenderer>().sprite = activatedSprite;
_audio.Play("Checkpoint");