Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Random {
- int punkty = 0;
- public void locateFood() {
- int r1 = (int) (Math.random() * 30);
- Snake.foodX = r1 * Snake.dot;
- int r2 = (int) (Math.random() * 30);
- Snake.foodY = r2 * Snake.dot;
- }
- public void Food() {
- if ((Snake.x[0] == Snake.foodX) && (Snake.y[0] == Snake.foodY)) {
- locateFood();
- Snake.dots++;
- punkty = punkty + 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement