Hi guys! right now I'm programming a simple zombie survival game and I want to keep adding the score with the use of an object. Whenever the player makes a decision there will be a certain points to be given to him or her. What's a simple way of making a scoring machine?
Here is a sample of what the code looks like:
System.out.println("\tYou have been hiding inside your house for a long time."); System.out.println("\tOutside there are plenty of zombies. What will you do?"); System.out.println(""); System.out.println("\t\t=================================================="); System.out.println("\t\t|| [1] Barricade the house ||"); System.out.println("\t\t|| [2] Go outside and fight the zombies ||"); System.out.println("\t\t|| [3] Search for supply ||"); System.out.println("\t\t|| [4] Escape through the back ||"); System.out.println("\t\t=================================================="); System.out.println("\t\tWhat would it be?:"); int ans1 = keyIn.nextInt(); if(ans1 == 1) HomeGame.home1a(); //add score if(ans1 == 2) HomeGame.home1b(); //add score if(ans1 == 3) HomeGame.home1c(); //add score if(ans1 == 4) HomeGame.home1d(); //add score
I would really appreciate the help guys. Thanks!