Give a ⭐ if you like it!
Java-SnakeGame is a project of an interesting snake game, which is developed in JavaSE with Swing framework. Genrally, this snake is made up with the help of drawArc
method and setStroke
method to set the Stroke
interface, as shown below:
Stroke stroke = new BasicStroke(float width);
g2d.setStroke(stroke);
g2d.drawArc(int x, int y, int width, int height, int startAngle, int arcAngle);
And, this snake seem to move in wave motion with the help of changing the startAngle parameter of drawArc
method, and then, repainting the JPanel
of the ground.
If you want to know, "How's the snake moving in the JPanel
?", may this Show Controls option will help you. Snake can move in both light and dark colored lines, as shown in image above. Moreover, you can also change the speed of the snake, here.
There are Three ways to control the snake in game:
- GUI Arrow Buttons
- Keyboard Arrow Buttons
- Mouse Click
- Full Setup Size : 2.19 MB
- Programming Language : Java (JavaSE)
- Framework Used : AWT and Swing
- Operating System : Any (Platform Independent)
- JRE version : 8.0 or higher
- Development Environment : VS Code, Eclipse, IntelliJ IDEA (recommended)
Note :- Image in application works properly in IntelliJ IDEA
.
https://github.com/mohitsainiknl/Java-SnakeGame/archive/refs/heads/master.zip
https://github.com/mohitsainiknl/Java-SnakeGame/blob/master/publish/Java-SnakeGame.jar
https://github.com/mohitsainiknl/Java-SnakeGame/blob/master/publish/Java-SnakeGame.exe
"Suggestions and project Improvements are Invited!"
Thanks a lot
Mohit Saini