I am new to java or well mainly everything. I am making a 'General Knowledge' game for a school project, I have a timer down and the questions. But I would like to know if there is a code I will be able to use to make points, for example: For every question they get right, it adds one point, then when the timer runs out or the game ends it is able to add the points together and give a total. For the questions, I am using the If else statement to determine whether the answer is correct or not.
Any help is very much appreciated.

8 Years
Discussion Span
Last Post by KirkPatrick

You could create an integer and inside your if else statements add 'x' amount of points per correct answer.

if (question is correct) {
//add points to the int

You could also display the points somewhere in the game so they know how they are doing if you'd like.

So it should be quite simple, just create an integer that will keep track of the points, for every correct question add points (in your if else statements), when the timer ends pull the final value of the integer. Once the game restarts, reset the integer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.