EKANS is my simple implementation of the classic Snake game. There is a snake and there is food. Get the food, your snake grows, the head of the snake has to be inbound and can't touch any of its body parts. Each food is worth one point. Points are not saved.
I set forth to accomplish four three things...
- Get familiar with JavaFX again following MVVM design pattern.
- Instead of drawing everything. I wanted to solve this with using nodes only (so no Canvas). I regret accomplishing (just made things way harder than they needed to be).
Fix size everything and try using FXML- Make it some what pretty
As you can see it went according to plan 100%.
- cool kids
- me
- Ability to move snake using UP DOWN RIGHT LEFT (also WASD)
- System keeps track of score (length of the snake)
- Que up valid moves ahead of time to make handling the snake more intuitive.
Download Java 14 Download EKANS jar Download bat file or... create a bat file named whatever you want enter...
@echo off
PATH_TO_JAVA_14_EXE -jar ekans-1.0-SNAPSHOT-exec.jar
pause
I might make this easier by wrapping jar into native runnable so to by pass downloading 14 and bat file but for now this is the way...
You can also fork my project, for your run configuration you will need to add this to VM arguements....
--module-path C:\Java\javafx-sdk-14\lib --add-modules javafx.controls,javafx.base,javafx.fxml --add-exports javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED
- Paint or have nodes unmanaged to make things easier
- Use fixed sizes for things and rather scale whole project together than individually
- I liked move que however it may need more work to allow buttons being held down while pressing others
- Snake body parts implementation is not efficient but I did find it elegant on how I updated body parts
- Grid system that doesn't relate directly to view I enjoyed
- Language: Java
- Library: JavaFX (with css)
- Framework: SpringBoot (starter)
