summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Player/GroundCheckScript.cs
diff options
context:
space:
mode:
authornirav <nirav@airmail.cc>2020-12-12 07:18:36 +0000
committernirav <nirav@airmail.cc>2020-12-12 07:18:36 +0000
commit115f77bda0246a00f6e17469685c67746bdbd29d (patch)
tree4bbea1e59109bb1d1fddc71736f89289bab03073 /Assets/Scripts/Player/GroundCheckScript.cs
download01-master.tar.gz
01-master.zip
Initial commitHEADmaster
Diffstat (limited to 'Assets/Scripts/Player/GroundCheckScript.cs')
-rwxr-xr-xAssets/Scripts/Player/GroundCheckScript.cs25
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;
+ }
+}