Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Quit Button  (Read 5816 times)

0 Members and 1 Guest are viewing this topic.

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Quit Button
« on: March 05, 2009, 05:07:33 PM »

Because of request I have the Quit button give you a choice to either Quit or Return to Main Menu.  It looks like this:

Do you want to quit or return to main menu?

Quit      Main Menu

Quit button works fine---Main Menu button does too BUT

The mainmenu window remains open when you get back to the Menu screen and of course the Menu screen has its own options of what to do.

Is there a way to close it without causing any problems?

Relevant script--MM is the new Main Menu button
yes is the Quit button--I just changed the text to say Quit instead of Yes---didn't change the name of the button

Code: WME Script
  1. #include "scripts\base.inc"
  2. #include "scripts\keys.inc"
  3.  
  4. this.xResult = false;
  5.  
  6.  
  7. ////////////////////////////////////////////////////////////////////////////////
  8. on "close"
  9. {
  10.   this.Close();
  11. }
  12.  
  13.  
  14. ////////////////////////////////////////////////////////////////////////////////
  15. on "yes"
  16. {
  17.   this.xResult = true;
  18.   this.Close();
  19. }
  20.  
  21.  
  22. on "MM"
  23. {
  24. Game.ChangeScene("scenes\Menu\Menu.scene")
  25. hud.Visible = false;
  26. this.Close();
  27. }
  28.  
  29.  

Am I messing with fireworks by changing a system object's code?

Any help is appreciated.

« Last Edit: March 05, 2009, 05:11:38 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Quit Button
« Reply #1 on: March 05, 2009, 07:54:57 PM »

I think the Tetris game works this way but I don't have the source and can't find it here.
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Quit Button
« Reply #2 on: March 05, 2009, 09:55:27 PM »

What if you change it to something like

Code: WME Script
  1. if(Scene.Name != "Menu") Game.ChangeScene("scenes\Menu\Menu.scene");
  2.  

so that it only loads the menu scene if it's not already there?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Quit Button
« Reply #3 on: March 05, 2009, 10:32:19 PM »

I will try it later tonight. Thanks very much.
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Quit Button
« Reply #4 on: March 06, 2009, 01:39:16 AM »

I still can't get rid of the mainmenu after you change scene to Menu.  I can get rid of it by clicking the x button on the upper right but there seems to be no other way to get it smoothly and discreetly to close.
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
Re: Quit Button
« Reply #5 on: March 06, 2009, 03:54:00 AM »

Cat.. think you can re-state your problem... i am not sure i understand it.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Quit Button
« Reply #6 on: March 06, 2009, 06:05:46 AM »

I'll try.  : )

If you normally hit Esc button, you bring up the window called mainmenu.

Normally that window asks you if you want to quit, yes or no are the choices.  If you hit yes you quit the game.

But....one of my betatesters thought it is more reasonable to have a choice to quit or go to the main menu.  I agree that's a good choice.  :  )

So I recoded the quit window. 

Now my quit window asks you if you really want to quit the game or go to the main menu.

If you choose Quit, no problem.... same as before.

But if you choose go to Main Menu, you go there but the mainmenu menu still shows up asking you all the stuff it asks and in addition you have the same stuff on the menu scene. 

Here is the screenshot.  Since the Menu asks all this stuff my betatester thinks it's too much to have the mainmenu screen pop up.  He has tested thousands of games and he's right but I don't know how to fix it without the game freezing. You can google him--Eric Pankoke (PointofLight)--he's mostly tested and reviewed pocket pc games but he was kind enough to test this game for me since we go back.  :  )

« Last Edit: March 06, 2009, 10:29:08 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Quit Button
« Reply #7 on: March 06, 2009, 08:46:47 AM »

Oh, you have TWO main menus in your game? It would have been better to only have one and load the main menu window in the menu scene...
Anyway, you can probably fix your problem by adding something like this to scene_init.script of the menu scene:

Code: WME Script
  1. global WinMenu;
  2. if(WinMenu != null)
  3. {
  4.   WinMenu.Close();
  5.   Game.UnloadObject(WinMenu);
  6. }
  7.  

So that the menu scene detects if the window is visible, and if so, shut it down.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Birdline

  • Supporter
  • Occasional poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 57
    • View Profile
    • Birdline Web Site
Re: Quit Button
« Reply #8 on: March 06, 2009, 09:31:09 AM »

I use a similar setup and is working OK.
On the button that takes you to the startup scene, I use this:
Code: WME Script
  1. on "yes"
  2. {
  3.         global GameUp; //this is for manually reset the game, so ignore it
  4.         Game.Reset();
  5.         this.Close();
  6.         Game.FadeOut(3000);
  7.         GameUp.StopDown(); ////this is for manually reset the game, so ignore it
  8.         Game.ChangeScene("scenes\Start\StartMenu\StartMenu.scene", false, false);
  9.         Game.FadeInAsync(2000)
  10.         Game.UnloadObject(this);
  11. }
  12.  

As I saw from the screen shot, I must say that you should not have a Save and a Resume buttons in
you startup scene. There is nothing to save/resume from this scene.
Since the only reason to be able to return to the startup scene is to actually start a new game,
you should reset your game.
I also suggest to watch the debug window (when test running the game). This way you
can see whenever some windows or anything else is still open / running.

Spyros
« Last Edit: March 06, 2009, 03:19:36 PM by Birdline »
Logged

maze

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 59
  • Good news
    • View Profile
Re: Quit Button
« Reply #9 on: March 06, 2009, 03:01:45 PM »

I agree with Mnemonic and Birdline. In a few words: You should only have one menu and it should be a window.

Another point against saving from a mainmenu scene: If you save your game from the mainmenu scene you get a thumbnail of the mainmenu instead a thumbnail of the current game scene.
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Quit Button
« Reply #10 on: March 06, 2009, 10:28:38 PM »

I've simplified my menu and solved the problem of the quit button.  Thanks for all your help.  I'm so glad I put that screenshot up.  I'm going to take it down now not to clutter up this site.  Thanks again to all of you!
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  
 

Page created in 0.091 seconds with 24 queries.