I would like to test out this game by running it in my command prompt. I am able to compile both of the java files alone but not sure what to do from there. So far I've:
So far my inputs in cmd are:
What do I do from here?
This is the link to the source code of the 2 java files. http://zetcode.com/tutorials/javagamestutorial/snake/
Put all you files in the directory javaprogram
I mean all of them : Snake.java,Board.java,head.png,dot.png and apple.png
Then you edit files Snake.java and Board.java
In Snake.java, remove package declaration at top of the file.
In Board.java, remove package declaration at top of file as well as edit the path of image files.
eg. ImageIcon iid = new ImageIcon("dot.png");
Once you have done all the above mentioned changes, use the below mentioned command:
javac *.java
- to compile files
javaw Snake
- to execute the program
Check whats the difference between java and javaw and javac.
If you are sending this game to someone just pack it in executable jar file.
Give my answer green tick :P