Skip to content

Repository files navigation

Snake Game

A JavaFX project made in Kotlin for university assignment.

Run the application with ./gradlew run.


Controls:

  • Arrows to control the snake
  • "P" key to stop/resume the game

Rules:

  • Pick up the edible to grow (yellow rectangle).
  • If you try to eat yourself you lose.
  • If your snake's length equals the grid (even when your snake does not cover the whole grid) you win (we do not want to play forever as in the classic snake).

Plus informations:

  • The end text and the game screen stays for 3 seconds.
  • After you press "P" there is a 3 seconds cooldown, after that you can resume, same after resume.

Difficulty levels:

The difficulty levels only change the time after which the snake automatically moves. In order:

  • EASY - 1.5 seconds
  • NORMAL - 1 second
  • HARD - 0.2 second

Packages and Classes/Files:

  • data package:
    • Directions: the kotlin file that contains the "Directions" enum class (like the arrows: UP, DOWN, LEFT, RIGHT)
    • SnakeBodyPart: data class for a single part of the snake's body
  • snakelogic package:
    • Snake: contains the logic for the whole snake (the body and the head)
    • SnakeHead: contains the head logic, basically the movement (also contains the image of the head)
  • Game: the whole Game logic and every drawing stuff
  • Main.kt: the entry point for the programme
  • Util.kt: the function to read any resource file

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages