Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Feb 2012
Offline Last Active Jul 03 2013 11:21 PM

#5072373 GO home viking raiders "your drunk"

Posted by dtkaos on 23 June 2013 - 07:28 PM

Tip for your code. Within the switch call methods/functions instead of having the code display there. It will clean it up nice!  If you notice you are repeating yourself... create a method becuase the further you get the more the code blurs together. If you need to change a value... you are going to have to change it 9 times ... I know you don't want to do that. :)


Also for the switch statments, use a variable name that has some meaning so when you go back to look at it  say something meaningful like

private static final int DOWN = 0;
private static final int UP = 1;


   case DOWN: 
    case UP:

            System.out.println("Doing something in default, Always good pratice to have a default");

private void moveDown(){
         // move that code from the switch statement here 

private void moveUp(){
       //move that code from the switch statement here


My first game code was pretty rubish. While yours is nice a neat I do belever everything I wrote was declared public and condensed to one file haha. Felt like a lot of code at the time but I believe it was only 50 -100 lines and I have work projects that spread thousands of line that are easier to read then it was. haha