Skip to main content
added 2 characters in body
Source Link
Vogel612
  • 25.3k
  • 7
  • 58
  • 141

Two small comments:

Naming:
The convention for variable names in Java is camelCase. Your animationframe should instead be animationFrame when going by that rule. Similar for your animaxspeed. You don't have to save characters in your code, write it out: animationMaxSpeed.
anispeed can also be written out: animationSpeed. This should make your code even more clear than it is ;)

Braces:
It's also convention to place all if-blocks in braces, disregarding whether they have to, or not. This is to decrease the possibility of bugs when changing such blocks and forgetting braces.

if (animationFrame == 3) {
    animationFrame = 0;
}

Also the Java-Coding-Standard is 4 spaces indentation. It might be, that the markup for SE broke yours, but either way, your first if-statement is too far in.

Two small comments:

Naming:
The convention for variable names in Java is camelCase. Your animationframe should instead be animationFrame when going by that rule.

Braces:
It's also convention to place all if-blocks in braces, disregarding whether they have to, or not. This is to decrease the possibility of bugs when changing such blocks and forgetting braces.

if(animationFrame == 3){
    animationFrame = 0;
}

Also the Java-Coding-Standard is 4 spaces indentation. It might be, that the markup for SE broke yours, but either way, your first if-statement is too far in.

Two small comments:

Naming:
The convention for variable names in Java is camelCase. Your animationframe should instead be animationFrame when going by that rule. Similar for your animaxspeed. You don't have to save characters in your code, write it out: animationMaxSpeed.
anispeed can also be written out: animationSpeed. This should make your code even more clear than it is ;)

Braces:
It's also convention to place all if-blocks in braces, disregarding whether they have to, or not. This is to decrease the possibility of bugs when changing such blocks and forgetting braces.

if (animationFrame == 3) {
    animationFrame = 0;
}

Also the Java-Coding-Standard is 4 spaces indentation. It might be, that the markup for SE broke yours, but either way, your first if-statement is too far in.

Source Link
Vogel612
  • 25.3k
  • 7
  • 58
  • 141

Two small comments:

Naming:
The convention for variable names in Java is camelCase. Your animationframe should instead be animationFrame when going by that rule.

Braces:
It's also convention to place all if-blocks in braces, disregarding whether they have to, or not. This is to decrease the possibility of bugs when changing such blocks and forgetting braces.

if(animationFrame == 3){
    animationFrame = 0;
}

Also the Java-Coding-Standard is 4 spaces indentation. It might be, that the markup for SE broke yours, but either way, your first if-statement is too far in.