Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Problems with instantiating order and referencing in JavaFX Snake game


I'm working on this Snake game, but i have some problems.

My Game class is a singleton, which is given a reference to the view controller, so the game has access to data about window size and so. But I'm not able to control whether the controller class is instantiated before I'm reaching in for some data.

The project is on my github. Run the program, and you will be led straight to the problem. https://github.com/danielbjorkholm/dB_SnakeGame_FX

Maybe I've missed something ? Feel free to contribute to the project or give a guess to have I can solve this challenging and exciting problem :)