Hello
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.
Thanx

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.