So i made it that when i press space the player flips unto the top platform but when he flip and starts floating to the top platform he cant jump anymore
Here’s the code
public class SwitchGravity : MonoBehaviour
{
private Rigidbody2D _body;
private Player player;
private bool top;
void Start()
{
player = GetComponent();
_body = GetComponent();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
_body.gravityScale *= -1;
Rotation();
}
}
void Rotation()
{
if(top == false)
{
transform.eulerAngles = new Vector3(0, 0, 180f);
}
else
{
transform.eulerAngles = Vector3.zero;
}
top = !top;
}
}