Advertisement
Guest User

Untitled

a guest
May 7th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1.  
  2. public class Random {
  3.    
  4.     int punkty = 0;
  5.    
  6.     public void locateFood() {
  7.         int r1 = (int) (Math.random() * 30);
  8.         Snake.foodX = r1 * Snake.dot;
  9.        
  10.         int r2 = (int) (Math.random() * 30);
  11.         Snake.foodY = r2 * Snake.dot;
  12.     }
  13.    
  14.     public void Food() {
  15.        
  16.         if ((Snake.x[0] == Snake.foodX) && (Snake.y[0] == Snake.foodY)) {
  17.             locateFood();
  18.             Snake.dots++;
  19.            
  20.             punkty = punkty + 1;
  21.         }
  22.     }
  23.    
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement