diff options
Diffstat (limited to 'Assets/Scripts/Player/GroundCheckScript.cs')
-rwxr-xr-x | Assets/Scripts/Player/GroundCheckScript.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Assets/Scripts/Player/GroundCheckScript.cs b/Assets/Scripts/Player/GroundCheckScript.cs new file mode 100755 index 0000000..4dbace7 --- /dev/null +++ b/Assets/Scripts/Player/GroundCheckScript.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using System.Collections; + +public class GroundCheckScript : MonoBehaviour { + + public PlayerMovementScript player; + + void OnTriggerEnter2D(Collider2D col) + { + if (col.tag == "Ground" || col.tag == "Platform") + player.grounded = true; + } + + void OnTriggerStay2D(Collider2D col) + { + if (col.tag == "Ground" || col.tag == "Platform") + player.grounded = true; + } + + void OnTriggerExit2D(Collider2D col) + { + if (col.tag == "Ground" || col.tag == "Platform") + player.grounded = false; + } +} |