Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class walk2 : MonoBehaviour {
  5. // Use this for initialization
  6. void Start () { }
  7.  
  8. void Update () {
  9. float move = 1.00f;
  10. for ( int i = 0 ; i < 10 ; i++){
  11. transform.position = new Vector2 (transform.position.x + move, transform.position.y);
  12. }
  13.  
  14. for ( int j = 0 ; j < 10 ; j++ ){
  15. transform.position = new Vector2(transform.position.x - move, transform.position.y);
  16. }
  17. }
  18. }
  19.  
  20. private float move = 0.1f;
  21. void Update() {
  22. if (transform.position.x < 10) {
  23. transform.position = new Vector2 (transform.position.x + move, transform.position.y);
  24. } else {
  25. transform.position = new Vector2 (transform.position.x - move, transform.position.y);
  26. }
  27. }
  28.  
  29. transform.position = Vector2.Lerp(starting_vector, target_vector, Time.deltaTime);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement