Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2011
    Posts
    28
    Rep Power
    0

    Default Creating a menu in a basic 2d game

    Hey so as you may have seen, I am making a pong remake for a Java course. I would like to add a menu functionality to my game. All I would want is Play, Scoreboard, and Quit buttons. I would like it to display when the game is brought up, and maybe when esc key is hit. I'm not sure how to go about doing this. In theory, I would like to be able to draw this once, and have it sitting somewhere in memory and when it is needed, to just pull it up. I feel like that would be more efficient than drawing it each time it is needed. Seems wasteful considering it will be the same each time. I am using AWT and Swing to handle graphics and this program. I have a little bit of experience using buttons in java, but nothing like what I'm wanting

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,789
    Rep Power
    7

    Default Re: Creating a menu in a basic 2d game

    Why not create a JMenu?

    Quote Originally Posted by ResidentBiscuit View Post
    I am using AWT and Swing
    Mixing AWT and Swing is a bad idea.

  3. #3
    Join Date
    Nov 2011
    Posts
    28
    Rep Power
    0

    Default Re: Creating a menu in a basic 2d game

    JMenu is all I have experience with, with what ive done it only really makes menu strips right? I'm looking for like a middle of the screen type menu, without visible "buttons". Imagine old school Doom games. Why is mixing the two a bad idea?

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,789
    Rep Power
    7

    Default Re: Creating a menu in a basic 2d game

    Do you want the menu to appear over the top of the game (which pauses it)? Use a dialog box. Do you want the menu to appear above/below/beside the game. Then create another JPanel.

    Swing uses lightweight components and AWT does not. If you want more information I'm sure Google will return plenty of articles on the subject.

  5. #5
    Join Date
    Nov 2011
    Posts
    28
    Rep Power
    0

    Default Re: Creating a menu in a basic 2d game

    I'm not sure what you mean with the directions. But I think I want on top of? Is there no way to place these buttons in the same frame?

  6. #6
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,789
    Rep Power
    7

    Default Re: Creating a menu in a basic 2d game

    Quote Originally Posted by ResidentBiscuit View Post
    Is there no way to place these buttons in the same frame?
    Yes that would be option 2 above. Use a second panel which holds the menu options and place it side-by-side to the panel which holds the game.

Similar Threads

  1. Replies: 3
    Last Post: 10-18-2011, 01:04 AM
  2. basic tic tac toe game help
    By java157 in forum New To Java
    Replies: 21
    Last Post: 04-23-2011, 08:55 PM
  3. Menu Help in TicTacToe Game
    By Ryan10 in forum New To Java
    Replies: 59
    Last Post: 04-04-2011, 05:19 AM
  4. Basic interface menu
    By Matthew in forum New To Java
    Replies: 2
    Last Post: 04-26-2010, 09:38 AM
  5. Need help with a menu button in a game
    By pjr5043 in forum Java Applets
    Replies: 1
    Last Post: 12-07-2008, 09:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •