Commit 3f8d4410 by Tim Reiter

fixed "getting stuck in a wall" bug.

parent a8cee5b3
......@@ -90,7 +90,6 @@ public class PlayerControl : MonoBehaviour
//Update last position:
lastPos = transform.position;
if (isGrounded())
velocity.y = 0;
......@@ -142,6 +141,7 @@ public class PlayerControl : MonoBehaviour
float verticalSmoothedFactor = isGrounded() ? 0 : inAirDampingVertical;
if (velocity.y > 0.0f) velocity.y = Mathf.Lerp(velocity.y, 0, Time.deltaTime * verticalSmoothedFactor);
/*==========Power Ups // Bullet management ===*/
if (inputMapping.isShootPressed())
{
......@@ -162,11 +162,11 @@ public class PlayerControl : MonoBehaviour
}
//finally set the velocity:
Debug.Log(velocity.y);
body2D.velocity = velocity + currentPushSpeed;
//update move direction after the currentposition was updated:
moveDirection = (transform.position - lastPos).normalized;
}
private bool isGrounded()
......
......@@ -82,7 +82,7 @@ public class PlayerInputMapping : MonoBehaviour {
public bool isJumpPressed()
{
if (usesGamepad) return GamePad.GetButtonDown(GamePad.Button.A, gamepadIndex);
if (usesGamepad) return GamePad.GetButton(GamePad.Button.A, gamepadIndex);
else return Input.GetKey(keyCodes[(int)Keys.Jump]);
}
......@@ -113,7 +113,7 @@ public class PlayerInputMapping : MonoBehaviour {
if (usesGamepad)
{
return (GamePad.GetTrigger(GamePad.Trigger.LeftTrigger, gamepadIndex) > 0.01f) || (GamePad.GetTrigger(GamePad.Trigger.RightTrigger, gamepadIndex) > 0.01f)
|| GamePad.GetButtonDown(GamePad.Button.LeftShoulder, gamepadIndex) || GamePad.GetButtonDown(GamePad.Button.RightShoulder, gamepadIndex);
|| GamePad.GetButton(GamePad.Button.LeftShoulder, gamepadIndex) || GamePad.GetButton(GamePad.Button.RightShoulder, gamepadIndex);
}
else return Input.GetKey(keyCodes[(int)Keys.Dash]);
}
......@@ -122,7 +122,7 @@ public class PlayerInputMapping : MonoBehaviour {
{
if (usesGamepad)
{
return GamePad.GetButtonDown(GamePad.Button.X, gamepadIndex) || GamePad.GetButtonDown(GamePad.Button.Y, gamepadIndex);
return GamePad.GetButton(GamePad.Button.X, gamepadIndex) || GamePad.GetButton(GamePad.Button.Y, gamepadIndex);
}
else return Input.GetKey(keyCodes[(int)Keys.Shoot]);
}
......
fileFormatVersion: 2
guid: b47b2bdb189943443b6c59dafedfd2cc
timeCreated: 1433521500
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment