Programming Snake Game in Java (fx) Tutorial - playproduction.de

Programming Snake Game in Java (fx) Tutorial

gaspar coding
Views: 55091
Like: 716
We will create a simple snake game in Java fx. The whole thing takes only 25 minutes and needs 200 lines of code. I have used eclipse with the plugin e(fx)clipse.
If you like what you see, please leave me a like. 🙂

Do you use Intellij IDEA? Then check out the video on how to run the code in IntelliJ:

More information about how to install JavaFX:

Music:
Where I am from , Topher Mohr and Alex Elena

You can download the code here.:

Great book to learn Java “Effective Java by Joshua Bloch”:

Thank´s for watching! 🙂

#JavaFX #GameDevelopment #Snake

43 Comments

  1. liked and subbed. Hope you make more video using eclipse and JavaFx.

  2. Very useful! Thank you for sparing your time on a GREAT video! liked and subscribed 🙂 You should definetely do more videos. !

  3. anyone else run into several problems when trying to run in IntelliJ. Using JDK 1.8 for FX, and I don't normally have any issues

  4. Thank you so much, it's an awesome tutorial!! I hope you will make more cool stuff like this 🙏

  5. Hey can I somehow run this game from another class? For example I have a menu class with 3 buttons: new game , high scores and exit can I make it that the game runs when i press the new game button? I tried Main.main(); but it does not work. 🙁

  6. Hey there, as promised some feedback!
    1. Great video, love this and please keep on doing!!
    2. I'd wish to have some more explanation, why we are setting up what for you know?
    + My gameover method is somewhere wrong as the game ends after i pressed 2 different directions

  7. May I get the souce code of the snake game ?

  8. Hello! Nice video! How can i add "Best Score" Option for the best score you reached?

  9. That's so wonderful 😁 keep up the great work

  10. When 2 keys are pressed quickly then snake collides with itself. Like if I press up then right or left, or down then right or left, same with left or right pressed first.
    This can be seen easily when speed is reduced to 1.
    Please help me correct this.

    Also explain the concept of corner.

  11. in line 152…can you explane why to add(new Corner(-1, -1)) ?
    Big thanks!

  12. May i ask which jdk are you using and are ypu using lwjgl?
    It says there is something called java lang module error

  13. can we build it without javafx application cause it is a pain in the ass to process that one

  14. I did it in Intellij IDEA and I have an error "Error:(3, 1) java: class, interface, or enum expected" on a line "package application;". Please, can you help me to fis it?

  15. The source code does not output
    I am using netbeans
    Please what do I do when I have a project delivered soon

  16. thank you so much 😭 this is such an easy way to do a snake game 😭

  17. chkoune je mil iset ylawej le projet? hhhhhhhhh

  18. The most simple and understandable code ever! Love it, perfect for beginners!

  19. how can we do it in a way the snake can leave the field and emerge from the other side?

  20. Hey, thanks for the really helpful tutorial. I had a doubt though…I couldn't understand what the 'cornersize' variable represents here

  21. how can i make a simple menu for this? like a start screen

  22. Great 😮!..it would be helpful if you build projects even in Android studio,thank you.

  23. Hello, what is it mean by set snake in three parts.
    snake.add(new Corner(width/2, height/2);
    Is this line for positioning snake at the beginning?
    Why do you have to do it 3 times?

  24. Hello! 🤩
    Can this full code exactly be working in Netbeans?

  25. Привет студентам сду)))

  26. My code runs perfectly but the images are not showing up however I am not getting any errors. Any help?

Leave a Reply

Your email address will not be published.