// thread run @Override public void run() { // thread while (true) { snake.move(dt, this); if (snake.getHead() == food.getR()) { food.eat(snake, map); foodEaten++; points++; } if (foodEaten == 2) { dt += 1; foodEaten = 0; } if (gameOver != inerGO) { dt = 0; tips.setText(this.chooseTips()); if (inerGO == true) { inerGO = false; } else { inerGO = true; } if (gameOver) { this.deathStuff(); } } if (frogJump == 0) { food.jump(); frogJump = 50; } frogJump--; repaint(); try { Thread.sleep(rate); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
public static void foodMethods(Food food) { food.onSelect(); food.eat(); }