r/CritiqueMyCode • • Sep 26 '14

[Java] 2D Java RPG Engine

https://github.com/RossBajocich/2D-Java-RPG-Engine
10 Upvotes

16 comments sorted by

View all comments

6

u/[deleted] Sep 26 '14

In your update-method in the Game class:

if (!menu_activated) {
	// game logic
} else {
	// menu logic
	menu.draw(hudScr);
}

Take a look at the State pattern. With States you can avoid avoid the ifs and clean up your Game class. You should also call the menu.draw(hudScr) from your draw method.