Awesome-Game-Team / Awesome-Game

An Awesome Game
GNU General Public License v3.0
8 stars 9 forks source link

Idea for pause menu #25

Open OneSleepyDev opened 8 years ago

OneSleepyDev commented 8 years ago

Can't code anything at the moment but I thought to share anyway to see what sticks.

To add a pause menu to the game we can add a condition in update() for the play state to check whether or not a pause button was pressed, if so, it would bring up an overlay with the mute, fullscreen, and sound fx options. When OK is pressed those vars are set and it breaks out and continues the game until pause is pressed again.

Thoughts?

` Semi-Psuedo code:

update()

if (pauseButton is pressed){
    tile semi-transparent black icon over screen
    show menu options
    if )ok is pressed){
        save changes
    } else{
        close pause menu
        }
} else{
original play state code
}`
jimfrize commented 8 years ago

This is a great idea, it will free up the screen space. We don't want to clog up the screen with icons. At the moment, we don't have that problem, but going forward this could be really useful!

metalx1000 commented 8 years ago

I like the idea, but I see some problems with the implementation of it. Or at lest in doing things the way I've done them in the past.

Example: Let's say we have a power up that makes the play invincible for a set amount of time, let say 5 seconds. I would normally get the current time, add 5 seconds to it, and save that to a variable.
player.invin = invincable += 5000;

Then in the update loop, I would check the if we've past that time or not to turn it off. if(game.time.now > player.invin){ //do what ever to turn that off }

The way you are talking about pausing the game wont stop that timer, so the second you unpause the game, that timer will have already run out. This will be true for anything that has a set "life span". For example shooting seeds have to die at time point, or they are just taking up RAM and CPU resources. So when shooting a seed you set it to be destroyed after so much time. If we go to "shoot" an enemy, and pause the game just before they are hit, if we wait to long and un pause the game it will be gone before hitting the target.

Now, I see that phaser's time function has a "game.time.gamePaused()" function, which I have not used. We should look into that, or see if there are any examples on the phaser website about pausing.

I also see that there is a "game.time.slowMotion" variable. That sounds like fun. We should also look into that and other timer options.

metalx1000 commented 8 years ago

This function pauses when this timer is also paused "game.time.events.seconds". So we could use that to time stuff.

Here is an example pause menu http://phaser.io/examples/v2/misc/pause-menu

OneSleepyDev commented 8 years ago

@metalx1000 That example looks great! I tried looking at a pause menu before, but for some reason I must have missed this. Since it's built in and seems to cover the concerns, I say we use that if everyone's for it.

OneSleepyDev commented 8 years ago

Working on implementing this. Could you assign this to me @metalx1000 ?

metalx1000 commented 8 years ago

Ok, So I created an organization and moved the repository there/here. Now I can assign people to things and I think I have a little more control over permissions and I can give you guys a little more control over stuff here...but I need to figure all this out.

metalx1000 commented 8 years ago

@OneSleepyDev You should have received an email about becoming part of the "Awesome Game Team". Once you confirm that I should be able to assign you to this.

OneSleepyDev commented 8 years ago

Joined! Thanks @metalx1000 !