9 Replies - 2260 Views - Last Post: 09 November 2013 - 11:18 AM

#1 floppyJoes   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 31-October 13

How can I make a start and exit menu in my XNA game?

Posted 04 November 2013 - 07:05 AM

Hey guys (and girls),

So I'm pretty much done with my XNA game. but I need a start menu.
I tried googling it and found some really intimidatingly difficult turorials.
Which I don't understand at all. My question is: can somebody explain how I can create a simple starting menu in which you can boot up the game and exit the game completly.

Thanks in advance,

-Floppy Joe's
Is This A Good Question/Topic? 0
  • +

Replies To: How can I make a start and exit menu in my XNA game?

#2 BBeck   User is offline

  • Here to help.
  • member icon


Reputation: 792
  • View blog
  • Posts: 1,886
  • Joined: 24-April 12

Re: How can I make a start and exit menu in my XNA game?

Posted 04 November 2013 - 07:45 AM

The simple way is through game states.

I would use an enumeration, but you can use numbers for your game state.

Then you use a case/switch statement to control program flow. Since the game loop is in Update() and Draw() you would put switch statements to control program flow in both those methods.

So, if game state is one, then do menu functionality, which is capable of changing the game state to state 2.

If game state is two then do the functionality of the game. As part of that functionality, you might have the escape key change the game state back to state one.

That's the "simple" way, that I know of anyway. I posted about a month ago on my ridiculously over complicated method of handling it. :-)

This post has been edited by BBeck: 04 November 2013 - 07:45 AM

Was This Post Helpful? 1
  • +
  • -

#3 floppyJoes   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 31-October 13

Re: How can I make a start and exit menu in my XNA game?

Posted 04 November 2013 - 07:51 AM

This sounds really logical, problem is I don't have a clue still.
I understand what you're trying to tell me but I just don't know the commands and where exactly I have to put them.

I've been trying using a Form1.cs. In which it would show a form and there would be an start game and exit game button. I think it's working but it will only stay there for less than half a second so I can't really push the button...
Was This Post Helpful? 0
  • +
  • -

#4 Rhino1111   User is offline

  • D.I.C Regular
  • member icon

Reputation: 107
  • View blog
  • Posts: 259
  • Joined: 28-August 13

Re: How can I make a start and exit menu in my XNA game?

Posted 04 November 2013 - 08:00 AM

I'd suggest just doing a simple implementation of a screenmanager and basescreen + derived types, it really isn't that "hard" to implement at all. The control flow idea would cause a bunch of unnecessary bloat in the draw/update methods in the game class(yuck!).

Just realized though, implementing a screenmanager at the end of the project would probably require you to shift quite a bit of code around. Your entire game would need to be shifted into a "GameScreen : BaseScreen" class.

This post has been edited by Rhino1111: 04 November 2013 - 08:05 AM

Was This Post Helpful? 0
  • +
  • -

#5 tHc   User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 66
  • Joined: 12-October 13

Re: How can I make a start and exit menu in my XNA game?

Posted 04 November 2013 - 08:21 AM

As BBeck say game states is your best way and should not take long to implement.
Was This Post Helpful? 1
  • +
  • -

#6 floppyJoes   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 31-October 13

Re: How can I make a start and exit menu in my XNA game?

Posted 04 November 2013 - 08:21 AM

I have to have it finished by tomorrow. haha
And as I mentioned in earlier posts, I am extremely new to programming. So I may look like a retard but it's really hard to comprehence what you mean, half the words are words which I cannot link to an explanation and googling it all just leaves me with difficult explanations for difficult words -_-

so thanks a lot for trying to explain it to me :) but I still don't understand any of it and I don't think you'd be able to give me an example and teach me that way?
Was This Post Helpful? 0
  • +
  • -

#7 floppyJoes   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 31-October 13

Re: How can I make a start and exit menu in my XNA game?

Posted 04 November 2013 - 01:59 PM

Thanks a lot to tHc for helping me with this.

-Floppy Joe's
Was This Post Helpful? 0
  • +
  • -

#8 tHc   User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 66
  • Joined: 12-October 13

Re: How can I make a start and exit menu in my XNA game?

Posted 05 November 2013 - 12:10 AM

View PostfloppyJoes, on 04 November 2013 - 01:59 PM, said:

Thanks a lot to tHc for helping me with this.

-Floppy Joe's


Your welcome sorry i did not have time to help more.

if you want the health to work remove this from your player update

//reset score if player health goes to zero
if (player.Health <= 0)
 {
 player.Health = 100;
 score = 0;
 }



and this from updatecollisons

//if the player health is less than zero we'll die
if (player.Health <= 0)
 {
  player.active = false;
 }



Should work fine then,i wont be about until late tonight as have work today then TKD with my daughter but will be around about 8.30 your time if you need more help.
Was This Post Helpful? 0
  • +
  • -

#9 xnafan   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 4
  • Joined: 06-November 13

Re: How can I make a start and exit menu in my XNA game?

Posted 06 November 2013 - 08:58 AM

Hi :)/>

How about this video - it has some good pointers :)/>
this video

Kind regards - Jakob "xnafan" Krarup
--
My xna blog and tutorials: http://www.xnafan.net
Was This Post Helpful? 1
  • +
  • -

#10 BBeck   User is offline

  • Here to help.
  • member icon


Reputation: 792
  • View blog
  • Posts: 1,886
  • Joined: 24-April 12

Re: How can I make a start and exit menu in my XNA game?

Posted 09 November 2013 - 11:18 AM

View Postxnafan, on 06 November 2013 - 09:58 AM, said:

Hi :)/>/>/>

How about this video - it has some good pointers :)/>/>/>
this video

Kind regards - Jakob "xnafan" Krarup
--
My xna blog and tutorials: http://www.xnafan.net



Cool blog! And Oyyou's channel too.

I added both to the XNA Resources list.

This post has been edited by BBeck: 09 November 2013 - 11:38 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1