Code Monkey home page Code Monkey logo

okdotdev / snake-java-swing Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 109 KB

This is a classic Snake game implemented in Java using the Swing framework. The game allows players to control a snake and navigate it around the game board to collect food. As the snake eats the food, it grows longer, and the player's goal is to achieve the highest possible score without colliding with the game's boundaries or the snake's own body

Java 100.00%
java java-swing snake snake-game

snake-java-swing's Introduction

๐Ÿ Snake Game in Java Swing ๐ŸŽฎ

Description

This is a classic Snake game implemented in Java using the Swing framework. The game allows players to control a snake and navigate it around the game board to collect food. As the snake eats the food, it grows longer, and the player's goal is to achieve the highest possible score without colliding with the game's boundaries or the snake's own body.

Features ๐ŸŽฏ

  • Simple and intuitive controls: Use arrow keys (Up, Down, Left, Right) to control the snake's direction.

  • Score tracking: The game keeps track of the player's score based on the number of food items collected and time/lenght of snake.

  • Game Over condition: The game ends if the snake collides with the boundary of the game board or with its own body.

  • Custom Food Items: The game includes various custom food items with different effects:

    • ๐ŸŽ Apple: Gives points and an extra segment to the snake.
    • ๐Ÿ–ค Black Apple: Kills the snake on contact.
    • ๐Ÿ Golden Apple: Gives extra points and an extra segment to the snake.
    • โœ‚๏ธ Scissors: Cuts off all segments of the snake.
  • Difficulty level: The speed of the snake depends on the lenght.

Requirements ๐Ÿ“‹

  • Java Development Kit (JDK) 8 or higher.

How to Play ๐Ÿ•น๏ธ

  1. Ensure you have Java installed on your system.
  2. Download the SnakeGame.jar file from the repository's releases page.
  3. Double-click on the SnakeGame.jar file or run the following command in the terminal:
    java -jar SnakeGame.jar
  4. The game window will open, showing the snake and a food item on the game board.
  5. Use the arrow keys to control the direction of the snake.
  6. The snake will automatically move in the current direction.
  7. Aim to eat the different types of food items by moving the snake over them. Each food item has a different effect.
  8. The game ends if the snake collides with the game board boundary, its own body, or a Black Apple.
  9. The game will continue until the player either wins by getting the maximum score or loses by colliding with obstacles.

Screenshots ๐Ÿ“ท

gameplay

Customization ๐Ÿ› ๏ธ

If you wish to modify the game or contribute to its development, you can clone the repository and make changes to the source code. The main game logic can be found in the SnakeGame.java file.

Credits ๐Ÿ™Œ

This Snake game implementation was inspired by various online tutorials and examples. Special thanks to the Java community for providing valuable resources and documentation.

License ๐Ÿ“œ

This Snake game is licensed under the MIT License. Feel free to use, modify, and distribute it as per the terms of the license.

Author ๐Ÿ‘ค

For any issues or suggestions related to the game, please feel free to create an issue or submit a pull request in the GitHub repository.

Enjoy playing the Snake game! ๐ŸŽ‰

snake-java-swing's People

Contributors

okdotdev avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.