Qu/Assets/Scripts/CheckPoint.cs
Gerard Gascón bd5b1556ff init
2025-04-24 14:23:29 +02:00

20 lines
546 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CheckPoint : MonoBehaviour{
public Transform checkpointPos;
void OnTriggerEnter2D(Collider2D col){
if (col.CompareTag("Player")){
col.GetComponent<PlayerController>().lastCheckpoint = checkpointPos.position;
}
}
void OnDrawGizmos(){
Gizmos.color = Color.green;
BoxCollider2D col = GetComponent<BoxCollider2D>();
Gizmos.DrawWireCube(col.transform.position, col.size);
}
}