Guest User

Untitled

a guest
Oct 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. public class MoveLeftConstantly : MonoBehaviour {
  2.  
  3. float posX;
  4. float posY;
  5. float speed = 0.1f;
  6.  
  7. // Use this for initialization
  8. void Start () {
  9. posY = transform.position.y;
  10. posX = transform.position.x;
  11.  
  12. }
  13.  
  14. // Update is called once per frame
  15. void Update () {
  16.  
  17. transform.position = new Vector3 (posX, posY, 0);
  18. posX -= speed;
  19. if (posX < -7f) {
  20. posX = 7f;
  21. }
  22. }
Add Comment
Please, Sign In to add comment