worked on platforms/moving platforms

This commit is contained in:
Rizvee committed 2022-02-24 18:50:19 -06:00
1 parent cd92d52be2
commit d10524a06a
7 files changed
+914 -11

No files matched your search

+12
View File
@@ -35,6 +35,18 @@ public class PlayerMovement : MonoBehaviour
jump = false;
}
//if colliding with platform, move with platform
void OnCollisionEnter2D (Collision2D other) {
if (other.gameObject.tag == "Platform") {
transform.parent = other.transform;
}
}
void OnCollisionExit2D (Collision2D other) {
if (other.gameObject.tag == "Platform") {
transform.parent = null;
}
}
public void ChangePos(double x, double y)
{