Improved
This commit is contained in:
@@ -14,6 +14,9 @@ public class Player : MonoBehaviour
|
||||
[SerializeField]private float forwardSpeed= 0.1f;
|
||||
[SerializeField]private float jumpCooldown = 0.5f;
|
||||
[SerializeField]private float radius = 0.5f;
|
||||
[SerializeField]private Animator jumpAnim;
|
||||
[SerializeField]private Transform paralEffect;
|
||||
[SerializeField]private Vector3 paralEffectVector;
|
||||
|
||||
[Header("Sprites")]
|
||||
public Sprite normalFace;
|
||||
@@ -56,6 +59,8 @@ public class Player : MonoBehaviour
|
||||
|
||||
playerRigidbody.bodyType = RigidbodyType2D.Static;
|
||||
playerRigidbody.gravityScale = 0;
|
||||
|
||||
defaultY = paralEffect.position.y;
|
||||
}
|
||||
int lastX = 0;
|
||||
void FixedUpdate()
|
||||
@@ -86,6 +91,12 @@ public class Player : MonoBehaviour
|
||||
body.Translate(Velocity);
|
||||
|
||||
CameraFollower.UpdateFrame();
|
||||
Parallex();
|
||||
}
|
||||
float defaultY = -100000;
|
||||
void Parallex(){
|
||||
paralEffect.Translate(paralEffectVector);
|
||||
paralEffect.position = Vector3.Lerp(paralEffect.position,new Vector3(paralEffect.position.x, defaultY),0.01f);
|
||||
}
|
||||
|
||||
void HandleDeath(){
|
||||
@@ -129,6 +140,8 @@ public class Player : MonoBehaviour
|
||||
jumpTimer =0;
|
||||
Velocity = new Vector2(Velocity.x, jumpForce);
|
||||
anim.CrossFadeInFixedTime("jump",0.01f);
|
||||
jumpAnim.CrossFadeInFixedTime("jump",0.01f);
|
||||
paralEffect.position -= new Vector3(0,20);
|
||||
StartCoroutine(switchToJumpFace());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user