Play the Game First
You need to have flash installed.
5 difficulty settings, 10 level layouts, Enjoy !
Source Code
You have just played the flash version of the game. Since this is a Java programming blog, the source code of the Java version will be provided at the end of this article. Of course it won't be compiled to a flash. Instead it will be compiled to a Java application. Nevertheless, the game control is identical to the flash version.Compile and Run
javac Snake10.java java Snake10
Adjusting difficulties
The Java version doesn't provide interface to adjust the game difficulty. However, as a programmer, you can do a little hack to the source code. Just locate the line :int difficulty = 3; // 1=hardest, 5=easiestin the method gameLoop(). Change it to any value between 1 and 5.
Explanation of Source Code
Selected portions of the source code will be explained in subsequent articles.Related Posts
- Tetris From Scratch
- Java Sound Programming
- Moving Object and Sprite Manager
- Digital Image Processing
hi Ivan i was wondering if you could explain the code for me because i have to make a game for my java class and i wanted to make a snake game, and if understood how your code worked, i was going to change it to fit my taste
ReplyDelete