Advertisement
Guest User

Untitled

a guest
May 24th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. //xdist is the distance between the center of the camera and the player. xvel_ is the player's x velocity, xpeed_ is the absolute value of xvel_
  2. xGo = xDist != 0f ? xDist / Mathf.Abs(xDist) : 0f;
  3. Debug.Log(follow.transform.position.x - (80f * xDist / Mathf.Abs(xDist)));
  4. if (Mathf.Abs(xDist) <= 48f || (xGo != Lily.xvel_ / Lily.xspeed_ && Lily.xspeed_ > 0f))
  5. {
  6. xDist = follow.transform.position.x - transform.position.x;
  7. //yDist = follow.transform.position.y - transform.position.y;
  8. }
  9. else
  10. {
  11. if ((xGo == Lily.xvel_ / Lily.xspeed_ && Lily.xspeed_ > 0f) || Input.GetAxisRaw("Horizontal") != 0)
  12. transform.position = new Vector3(follow.transform.position.x - (48f * xGo), transform.position.y, transform.position.z);
  13.  
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement