Changed bottom

This commit is contained in:
2021-07-21 09:54:17 +02:00
parent a4c22ed754
commit b8eb84a9c5
3 changed files with 8 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ public class PlayerControls : MonoBehaviour
public SpriteRenderer sprite;
public PhysicsMaterial2D bottom;
public CharacterController2D controller;
public RigidbodyConstraints2D topx;
public RigidbodyConstraints2D bottomx;
public AudioSource sfx;
public float runspeed = 40f;
float horizonatalaxis = 0f;
@@ -36,11 +38,13 @@ public class PlayerControls : MonoBehaviour
switchy = !switchy;
if (switchy){
sprite.flipY = true;
rb.constraints = topx;
rb.sharedMaterial = top;
controller.m_JumpForce = controller.m_JumpForce * 1.2f;
}
else {
sprite.flipY = false;
rb.constraints = bottomx;
rb.sharedMaterial = bottom;
controller.m_JumpForce = controller.m_JumpForce * 0.8f;
}