Team 12 Game Development Artifact 4- Menu state

Team 12 is working on a game called DashBat. The game is going to be a mix between speed runners adm super mario kart, the player is in a flying state. To progress through the level the player needs to avoid multiple objects at a high speed and to reach the end of the level in a short time.

 

Today I will try to explain one of the artifacts that I have worked on during the past two weeks. and that is Menu State.

Most games need a menu state, to navigate between the available mode or controls for the game. But the artifact that i have worked on is a lot simpler than most menus so lets start analyzing what it is, how was it built and for what reason.

 

What…

The menu state is consisted of  four components each differ in purpose. The first component is a background, the background is static sprite. In the future, it’s going to be an animated one. The second and the third component are the menu buttons, one to start the game and the other to quit. The last component is rather invisible, it’s a small rectangle shape that follows the mouse, the rectangle shape is used to detect if the it inside a specific area to execute an operation.

 

How…

Switching between states was done by checking if the rectangle shape is inside the start button’s sprite, when the condition is true, the current update function for the current state will return false, forcing the game to switch to the desired state. Since we use an engine, trying to communicate the mouse event through the other states was hard at the start, not only that the mouse positions was out of sync from the. This was easily fixed by getting the mouse position that is relative to the window that why, it return the exact values.

 

Why…

Other than the reason of to navigate easily through the game, I thought that creating a simple GUI was a good practice. Creating  a well designed GUI is hard and it can get a lot harder when new elements are introduced, luckily the game did not need a very complicated GUI. So for that reason, I took that chance to practice a bit.

 

Beta is next week, so my team and I will focus more on polishing the game, so stay tuned for more !

 

Marwan

About Marwan Al-Salman

2014  Programming