Haunted Light 2014-03-05 Options Menu

My assignment of the week is to create an options menu. I started with a mistake, the mistake that I did not think through how we wanted the options state to work which led to some undesired errors in both the options state as the game state.

Well I can begin with explaining the errors of my way, I started with the background because every state needs its own background…right? Well turns out that I should have read my lead programmers blog a bit more carefully. The state manager I previously worked on has been modified with additional methods such as Pause(), Resume(), Base() (not sure that I remember the correct naming of them). This means that instead of switching state entirely we pause certain states to not having to restart them every time we re-enter them. Such as the transition between main menu and options, we don’t want the main menu to repeat the starting animation every time so we simply paused the state when we enters options state.

It’s really handy but I noticed a cool bug when I was fiddling with the Pause method, I had accidentally left a call to the pause method in main menu so when we were in game state you could see the shape of the main menu background in the dirt of the level. It was easily fixed but it looked interesting.

Well back to the options state, because of the pause method we did not require a background, the engine simply puts a rectangle over the main menu’s background and lowers the brightness on the rectangle so that it seems like we are blurring out the main menus background.Bild

It’s kinda hard to see but there are a rectangle over the whole menu background with decreased brightness to give the feel of blurring.

So after the removal of the background and a bit more understanding on how the state manager has been modified I started adding some buttons and modifying the scale of the sprites etc. But the sprites and animations are all pretty but we need a button class so that is where I am at right now because we need to be able to actually press stuff.

I reckon that the Button class constructor needs to have an animated sprite(because we want a hover effect on the buttons), collider (to actually recognize a press) but I am also thinking of adding a keyboard pointer in case that there are someone that wants to control the menu with the keyboard. But I have one question? Do I need to include a mouse pointer as well? I guess so because of the clicking?

Well that’s a status update on where I am right now.