Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MoveLeftConstantly : MonoBehaviour {
- float posX;
- float posY;
- float speed = 0.1f;
- // Use this for initialization
- void Start () {
- posY = transform.position.y;
- posX = transform.position.x;
- }
- // Update is called once per frame
- void Update () {
- transform.position = new Vector3 (posX, posY, 0);
- posX -= speed;
- if (posX < -7f) {
- posX = 7f;
- }
- }
Add Comment
Please, Sign In to add comment