Skip to content

lucas6028/snake-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game

alt text

This is a classic Snake game implemented in Java using Swing for the graphical user interface. The game supports both single-player and two-player modes.

Table of Contents

Installation

  1. Clone the repository:

    git clone https://github.com/lucas6028/snake-game.git
    cd snake-game/demo
  2. Build the project using Maven:

    mvn clean install
  3. Run the game:

    java -jar target/Snake-game.jar

Usage

  • Run the game and use the keyboard to control the snake(s).
  • Eat fruits to gain points and avoid bombs.
  • The game ends when a snake collides with itself, another snake, or a bomb.

Game Features

  • Single-player and two-player modes.
  • Various types of fruits and bombs.
  • Increasing difficulty levels.
  • Sound effects for different game events.

Controls

Single Player

  • Arrow keys to move the snake.
  • Spacebar to shoot bullets.

Two Players

  • Player 1: Arrow keys to move, Enter to shoot.
  • Player 2: WASD keys to move, Spacebar to shoot.

Project Structure

.vscode/
    settings.json
pom.xml
src/
    main/
        java/
            com/
                snake/
                    Bomb.java
                    Bullet.java
                    ContainerPanel.java
                    Draw.java
                    Fruit.java
                    ImageLoader.java
                    Main.java
                    Node.java
                    OpeningScreen.java
                    ScoreFile.java
                    Snake.java
                    Sounds.java
                    Stone.java
                    TransparentButton.java
    resources/
        filename.txt
        images/
            background/
            bombs/
            buttons/
            fruits/
        sounds/
test/
    java/
        com/
            snake/
target/
    classes/
        com/
            snake/
        filename.txt
        images/
            background/
            bombs/
            buttons/
            fruits/
        sounds/
    generated-sources/
        annotations/
    maven-archiver/
        pom.properties
    maven-status/
        maven-compiler-plugin/
            compile/
            testCompile/
    Snake-game.jar
    test-classes/
        com/
            snake/

Screenshots

alt text alt text alt text alt text alt text

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.

About

This is a classic Snake game implemented in Java using Swing for the graphical user interface. The game supports both single-player and two-player modes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages