Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use game states in a simple FPS in JAVA
    text
    copied!<p>So for my computer programming minor project, we have to create a game in JAVA. They have given us a very simple engine-esque application which simply displays a 3D maze from a first person view through which the user can navigate. It's our job to make it a "full" fledged FPS with enemies. We use JAVA and OpenGL (JOGL)</p> <p>They have told us to use game states, but there was never a lecture about this and their answer was to google it. Well, what I googled is a tad bit too complicated to really grasp my head around, so I'll just ask specific questions with regards to the states.</p> <p>The game needs to have states for thing like pausing and the main menu. However, I also read that the player itself can also have states such as different firing modes.</p> <ol> <li><p>How would a UML diagram, or any diagram look like which includes a state class? Is it a hierarchical structure where the state class is on top? </p></li> <li><p>Are all states defined in a single state class? It's a simple game so we have: shooting, pausing, main menu, sprinting, ducking, health packs. (Maybe difficulties).</p></li> <li><p>If for example ESC is pressed, a method in UserInput will be fired. I assume that I somehow have to change the state of the game. This is kind of a sub question of question 1. What would be a clean way to change the state of the game? As in, how would I contact the state class?</p></li> </ol> <p>Are all of those states?</p> <p>Here is a UML diagram of what we have. <img src="https://i.stack.imgur.com/zcIre.png" alt="UML Diagram of the game"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload