There are a number of things to comment on here.
##Code-Style
Code-Style
Java coding style puts the {
opening brace at the end of the line containing the condition/construct that starts the block. Code like:
public char getFirstLetter() { return firstLetter; }
should be:
public char getFirstLetter() {
return firstLetter;
}
Additionally, there should be an empty line after the closing }
and the start of the next method declaration.
##Threads
Threads
You are using swing, yet I cannot see any places where you are accommodating work that is done on the Event Dispatch Thread (EDT) vs. your game thread.
This is likely to lead to inconsistent gameplay, irregular timing, and other problems.... especially during the manipulation of the Graphics objects.
##Terminology
Terminology
I am not seeing a Finite Automata here... this looks pretty open-ended, not finite.
##Magic Numbers
Magic Numbers
These are everywhere. There must be a better way to centralize them.
##Integer Arithmetic
Integer Arithmetic
This line:
double ns = 1000000000 / framesPerSecond;
is doing integer arithmetic, in your case, you would expect ns
to be 33333333.33.....
but it will be plain 33333333.0
because the integer division is done before the value is converted to a double. Consider using:
double ns = 1000000000.0 / framesPerSecond;
which converts the one value to a double, and thus the entire expresion is evaluated in the double-precision space.
in this case, the loss of accuracy will likely not significantly affect the game, but you should be aware.
There are a number of things to comment on here.
##Code-Style
Java coding style puts the {
opening brace at the end of the line containing the condition/construct that starts the block. Code like:
public char getFirstLetter() { return firstLetter; }
should be:
public char getFirstLetter() {
return firstLetter;
}
Additionally, there should be an empty line after the closing }
and the start of the next method declaration.
##Threads
You are using swing, yet I cannot see any places where you are accommodating work that is done on the Event Dispatch Thread (EDT) vs. your game thread.
This is likely to lead to inconsistent gameplay, irregular timing, and other problems.... especially during the manipulation of the Graphics objects.
##Terminology
I am not seeing a Finite Automata here... this looks pretty open-ended, not finite.
##Magic Numbers
These are everywhere. There must be a better way to centralize them.
##Integer Arithmetic
This line:
double ns = 1000000000 / framesPerSecond;
is doing integer arithmetic, in your case, you would expect ns
to be 33333333.33.....
but it will be plain 33333333.0
because the integer division is done before the value is converted to a double. Consider using:
double ns = 1000000000.0 / framesPerSecond;
which converts the one value to a double, and thus the entire expresion is evaluated in the double-precision space.
in this case, the loss of accuracy will likely not significantly affect the game, but you should be aware.
There are a number of things to comment on here.
Code-Style
Java coding style puts the {
opening brace at the end of the line containing the condition/construct that starts the block. Code like:
public char getFirstLetter() { return firstLetter; }
should be:
public char getFirstLetter() {
return firstLetter;
}
Additionally, there should be an empty line after the closing }
and the start of the next method declaration.
Threads
You are using swing, yet I cannot see any places where you are accommodating work that is done on the Event Dispatch Thread (EDT) vs. your game thread.
This is likely to lead to inconsistent gameplay, irregular timing, and other problems.... especially during the manipulation of the Graphics objects.
Terminology
I am not seeing a Finite Automata here... this looks pretty open-ended, not finite.
Magic Numbers
These are everywhere. There must be a better way to centralize them.
Integer Arithmetic
This line:
double ns = 1000000000 / framesPerSecond;
is doing integer arithmetic, in your case, you would expect ns
to be 33333333.33.....
but it will be plain 33333333.0
because the integer division is done before the value is converted to a double. Consider using:
double ns = 1000000000.0 / framesPerSecond;
which converts the one value to a double, and thus the entire expresion is evaluated in the double-precision space.
in this case, the loss of accuracy will likely not significantly affect the game, but you should be aware.
There are a number of things to comment on here.
##Code-Style
Java coding style puts the {
opening brace at the end of the line containing the condition/construct that starts the block. Code like:
public char getFirstLetter() { return firstLetter; }
should be:
public char getFirstLetter() {
return firstLetter;
}
Additionally, there should be an empty line after the closing }
and the start of the next method declaration.
##Threads
You are using swing, yet I cannot see any places where you are accommodating work that is done on the Event Dispatch Thread (EDT) vs. your game thread.
This is likely to lead to inconsistent gameplay, irregular timing, and other problems.... especially during the manipulation of the Graphics objects.
##Terminology
I am not seeing a Finite Automata here... this looks pretty open-ended, not finite.
##Magic Numbers
These are everywhere. There must be a better way to centralize them.
##Integer Arithmetic
This line:
double ns = 1000000000 / framesPerSecond;
is doing integer arithmetic, in your case, you would expect ns
to be 33333333.33.....
but it will be plain 33333333.0
because the integer division is done before the value is converted to a double. Consider using:
double ns = 1000000000.0 / framesPerSecond;
which converts the one value to a double, and thus the entire expresion is evaluated in the double-precision space.
in this case, the loss of accuracy will likely not significantly affect the game, but you should be aware.