public void resetGame() { try { timer.cancel(); } catch (IllegalStateException e) { } timer = new Timer(); timer.scheduleAtFixedRate(new FoodThrowingTask(), 0, 600); timer.scheduleAtFixedRate(new HealthPotionFallingTask(), 5000, 10000); foodList = new ArrayList<Food>(); potionsList = new ArrayList<Potion>(); usersCombinedScore = 0; fallingStuffSpeed = 90; currentLevel = startingLevel; healthRemaining = healthAtStart; setHealthoMeter(); user1.setPosition(200, 365); user2.setPosition(600, 365); user1.setVelocity(0, 0); user2.setVelocity(0, 0); animationTimer.start(); gameOver.set(false); System.out.println("Game has been reset"); }