WowieGameJam/Assets/Scripts/CheckGround.cs
Gerard Gascón a8c6025cd3 init
2025-04-24 14:07:24 +02:00

29 lines
691 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CheckGround : MonoBehaviour{
PlayerController player;
// Start is called before the first frame update
void Start(){
player = GetComponent<PlayerController>();
}
// Update is called once per frame
void Update(){
}
private void OnCollisionStay2D(Collision2D col){
if (col.gameObject.tag == "Ground"){
player.grounded = true;
}
if (col.gameObject.tag == "Fall"){
player.grounded = true;
}
}
private void OnCollisionExit2D(Collision2D col){
player.grounded = false;
}
}