duck

duck

May 21st, 2010
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. var moveDelay = 0.5f;
  4. var gridSize = 1;
  5. var x = 0;
  6. var y = 0;
  7.  
  8. var moveX = 0;
  9. var moveY = 0;
  10.  
  11. function Start() {
  12.     Move();
  13. }
  14.  
  15. function Move() {
  16.  
  17.     while (true) {
  18.         yield WaitForSeconds(moveDelay);
  19.    
  20.         // code here is executed once per 'move delay'.
  21.        
  22.         (check keys and change direction here)
  23.    
  24.    
  25.         x += moveX;
  26.         y += moveY;
  27.        
  28.         transform.position = Vector3 ( x * gridSize, 0, y * gridSize);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment