Giter VIP home page Giter VIP logo

snake's Introduction

Snake

Description

This is a simple snake game written in Java using the Swing library with Graphics2D.
Currently, it is in a very early stage of development, so it is not complete yet.

How to play

The goal of the game is to eat as many apples as possible.
In this adaptation, you can go through the walls and appear on the other side.
It's game over when the snake hits itself.
The snake grows by one block when it eats an apple.
The golden apple activates your ult for 7 seconds.
Your ult makes you twice as fast, makes you invincible, and you can go through the walls.
The enchanted golden apple activates your op ult for 7 seconds.
Your op ult is like the normal ult, but you are three times as fast and grow every second.

How to run

You need Java 8 installed on your computer to run this game.
You can download it here.

You can download the latest release here.
After downloading the JAR file, you can run it by double-clicking it.

You can either download the main JAR or the JAR with asset-streaming.
The main JAR contains all the assets, but it is a lot bigger.
The JAR with asset-streaming downloads the assets from the internet, so it is a lot smaller.
The downside is that you need a good and constant internet connection to run it.

Alternatively, you can run it from the command line with the following command:
java -jar Snake.jar

You can change the language of the game by adding the following argument:
java -jar Snake.jar en

Currently, the following languages are supported:

  • English (en)
  • German (de)
  • Italian (it)
  • Spanish (es)

and many other but not approved by native speakers.

I'm planning to add more languages in the future.
If you want to help me translate the game into your language , please contact me and read more.
Or else you can approve the translations here.

Controls

The snake is controlled by the arrow keys or WASD.
You can pause and resume the game by pressing escape.
To start the game, press space or enter.
You can exit the game by pressing Ctrl + C.

Debugging

You can enable an FPS counter by pressing F3 + F.
You can enable grid lines by pressing F3 + G.
You can enable hitboxes by pressing F3 + B.

Custom Assets

You can add your own assets to the game.
You can use both the main JAR and the JAR with asset-streaming.

  1. Create a .json file with the following structure:
{
  "icon": "/Images/Icon.png",
  "fieldWidth": 32,
  "fieldHeight": 16,
  "scale": 32,
  "fps": 60,
  "tps": 10,
  "specialFoodChance": 0.05,
  "specialFoodDuration": 7,
  "opUltGrowInterval": 1000,
  "ultSpeed": 2,
  "opUltSpeed": 3,
  "resizable": false,
  "solidWalls": false,
  "backgroundCover": "/Images/BackgroundCover.png",
  "backgroundTile": "/Images/BackgroundTile.png",
  "head": "/Images/Head.png",
  "upperBody": "/Images/UpperBody.png",
  "lowerBody": "/Images/LowerBody.png",
  "legTile": "/Images/LegTile.png",
  "legTransition": "/Images/LegTransition.png",
  "feet": "/Images/Feet.png",
  "food": "/Images/Food.png",
  "goldFood": "/Images/GoldFood.png",
  "foodSound": "/Audio/Eating.wav",
  "ultSound": "/Audio/Rainbow.wav",
  "dieSound": "/Audio/OOF.wav",
  "headAnimation": "/Animations/Head.gif",
  "upperBodyAnimation": "/Animations/UpperBody.gif",
  "lowerBodyAnimation": "/Animations/LowerBody.gif",
  "legTileAnimation": "/Animations/LegTile.gif",
  "legTransitionAnimation": "/Animations/LegTransition.gif",
  "feetAnimation": "/Animations/Feet.gif",
  "opFoodAnimation": "/Animations/OpFood.gif",
  "gridLayoutColor": "#000000",
  "snakeHitboxColor": "#FF0000",
  "foodHitboxColor": "#FFFF00",
  "fpsColor": "#FFFF00",
  "scoreColor": "#FFFF00",
  "textColor": "#000000",
  "backgroundColor": "#1E2428",
  "snakeColor": "#5662F6",
  "foodColor": "#E27662",
  "goldFoodColor": "#1CCB5B",
  "opFoodColor": "#FF00FF"
}
  1. Replace the paths with the absolute paths to your assets.
    If it doesn't work, try using forward slashes instead of backslashes or double slashes.
    For audio, there is currently only support for .wav files encoded with 16-bit PCM.
    For images, you can use .jpg, .jpeg, but .png works best.
    For animations, you can use .gif files.

  2. Run the game with the custom config file.
    For example: java -jar Snake.jar

Custom Language

You can use your language pack in the game.
You can use both the main JAR and the JAR with asset-streaming.

  1. Create a .json file with the following structure:
{
  "title": "Snake",
  "restart": "Restart",
  "restartToolTip": "Restart the game",
  "gameOver": "Game Over",
  "scorePrefix": "Score: ",
  "fpsPrefix": "FPS: "
}
  1. Replace the values with your translations.
    If you want to help me translate the game into your language, please contact me.

  2. Run the game with the custom language file.
    For example: java -jar Snake.jar

Languages

Approved

  • English (en)
  • German (de)
  • Italian (it)
  • Spanish (es)

Unapproved

  • French (fr)
  • Portuguese (pt)
  • Russian (ru)
  • Chinese (zh)
  • Japanese (ja)
  • Korean (ko)
  • Turkish (tr)
  • Polish (pl)
  • Dutch (nl)
  • Swedish (sv)
  • Czech (cs)
  • Hungarian (hu)
  • Danish (da)
  • Finnish (fi)
  • Norwegian (no)
  • Romanian (ro)
  • Slovak (sk)
  • Slovenian (sl)
  • Ukrainian (uk)
  • Vietnamese (vi)
  • Greek (el)
  • Bulgarian (bg)
  • Croatian (hr)
  • Lithuanian (lt)
  • Serbian (sr)
  • Arabic (ar)

Features

  • Snake movement
  • Apple spawning
  • Snake growing
  • Snake hitting itself
  • Snake going through walls
  • Snake hitting walls (optional)
  • Score
  • Golden apple
  • Asset-streaming
  • Sound effects
  • Ult Working
  • Ult Animation
  • Ult Sound
  • Ult Timer
  • Op Ult
  • Rotation
  • Restart
  • Pause
  • Resume
  • FPS Counter
  • Grid Lines
  • Hitboxes
  • Language Support
  • Custom Assets
  • Op Ult Animation
  • Win
  • Game Over
  • Menu

snake's People

Contributors

mcmodersd 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.