Hi! I'm current working on a game that would be like a harvest moon game. But right now I'm having a problem on how to be able to count the day per end of each turn. Here's the sample code. Sorry but I'm still a newbie on Java Programming.
public class GameMenu { public void Main() { FarmMap map = new FarmMap(); Calender date = new Calender(); GameMenu r = new GameMenu(); Scanner keyIn = new Scanner(System.in); System.out.println("--------------------------------"); System.out.println("|| [1] Go to Farm ||"); System.out.println("|| [2] Go to Shop ||"); System.out.println("|| [3] End the day ||"); System.out.println("--------------------------------"); System.out.println("\nWhat would you like to do? "); int ans1 = keyIn.nextInt(); if(ans1 == 1) map.FarmMap1(); if(ans1 == 3) { date.Spring(); } } }
public class Calender { GameMenu m = new GameMenu(); public void Spring() { int Day = 0; Day++; System.out.println("Day "+Day+", Spring"); m.Main(); if(Day == 30) { System.out.println("It's Summer Time!"); } }
Here is the outcome...
Welcome to the farm game! -------------------------------- || [1] Go to Farm || || [2] Go to Shop || || [3] End the day || -------------------------------- What would you like to do? 3 Day 1, Spring -------------------------------- || [1] Go to Farm || || [2] Go to Shop || || [3] End the day || -------------------------------- What would you like to do? 3 Day 1, Spring -------------------------------- || [1] Go to Farm || || [2] Go to Shop || || [3] End the day || -------------------------------- What would you like to do? 3 Day 1, Spring -------------------------------- || [1] Go to Farm || || [2] Go to Shop || || [3] End the day || -------------------------------- What would you like to do?
I would really appreciate the help guys