Please help with infinite gravity swapping problem
I'm making a game where you are running down a stage and trying to swap the forces of gravity to make it to the next platform like the game "Gravity Guy" as seen in this clip here https://www.youtube.com/watch?v=iVTqXnJAotQ . I'm trying to make it so you cant swap mid air but everything I've try'ed has not worked can anyone help me
Here's my script: using UnityEngine;
public class gravityControler : MonoBehaviour {
 private Rigidbody2D rb;
 public bool grounded;
 private bool top;
 // Use this for initialization
 void Start () {
     rb = GetComponent<Rigidbody2D>();
 }
 
 // Update is called once per frame
 void Update () {
     if (Input.GetKeyDown(KeyCode.Space) && grounded) {
         rb.gravityScale *= -1;
     }
 }
 void OnCollisionStay2D(Collision2D Other)
 {
     if (Other.collider.gameObject.tag == "ground")
     {
         grounded = true;
         Debug.Log("Entered The Colider");
     }
 }
 
              Your answer
 
             Follow this Question
Related Questions
How to make a character float up in a 2D game 0 Answers
What is the best way to make Object sticky (adaptive gravity) ? 1 Answer
How To Make my Player Glide in 2d platformer 3 Answers
How to cancel the force caused by collision? So the player is not pushed away when it hits a corner? 0 Answers
2D Velocity movement on slope hops when moving left/right 0 Answers