Question by
davisonsam · Apr 24, 2016 at 11:22 PM ·
loop animaiton
My character only rotates once??
I'm making a game where my character when the space bar is pressed the gravity switches and he runs on the ceiling, everything works great until you try and swap the gravity again. The gravity changes direction, but my character doesn't flip, he just bonks his head on the floor, any remedies?
private void FixedUpdate() {
// Read the inputs.
//bool crouch = Input.GetKey(KeyCode.LeftControl);
//float h = CrossPlatformInputManager.GetAxis("Horizontal");
// Pass all parameters to the character control script.
if (Input.GetKeyDown (KeyCode.Space) && doSwap && faceUp)
{
character.swapGravity ();
Debug.Log ("Hit Space");
character.transform.Rotate (180, 0, 0);
//if(faceUp)
//faceUp = false;
}
//if (Input.GetKeyDown (KeyCode.Space) && doSwap && !faceUp)
//{
// character.swapGravity ();
// Debug.Log ("Hit Space");
// character.transform.Rotate (180, 0, 0);
// if(!faceUp)
// faceUp = true;
else if (!doSwap){
doSwap = true;
Debug.Log ("Changed");
}
character.Move(1, false, jump);
jump = false;
Comment