Results 1 to 4 of 4
  1. #1
    gomdohri is offline Member
    Join Date
    Sep 2011
    Posts
    22
    Rep Power
    0

    Default Tried to put the menu on my game but...stuck.. help me

    Done i have solved it don"t worry ^_^
    Attached Files Attached Files
    Last edited by gomdohri; 10-18-2011 at 01:31 AM.

  2. #2
    DiamondSoul is offline Member
    Join Date
    Oct 2011
    Posts
    83
    Rep Power
    0

    Default Re: Tried to put the menu on my game but...stuck.. help me

    It would be helpful if you specified what exactly the program is doing that you don't like. Is it throwing an exception? Is it not displaying the menu? Is it not starting the game when you press start? Is it starting the game before you press start?

  3. #3
    gomdohri is offline Member
    Join Date
    Sep 2011
    Posts
    22
    Rep Power
    0

    Default Re: Tried to put the menu on my game but...stuck.. help me

    When I press the 'Start Game menu button' it turns to gray background but.. the thing is that I want to start the game... but I am sure I have to change

    public void mousePressed(MouseEvent e){
    int mx = e.getX();
    int my = e.getY();
    if(mx > startButton.x && mx < startButton.x+startButton.width &&
    my > startButton.y && my < startButton.y+startButton.height){
    gameStarted = true; // This part
    }

    But this class is not in the main 'Teeter.class' so I can't start like this...;;

  4. #4
    DiamondSoul is offline Member
    Join Date
    Oct 2011
    Posts
    83
    Rep Power
    0

    Default Re: Tried to put the menu on my game but...stuck.. help me

    Okay, I haven't read through your code thoroughly, but I think that, instead of putting your if(gameStarted){...}else{...} in your main method, put one in your paint method and another one in your timer method. The main method runs only once, so once your if/else block picks which path it goes down, it stays on that path and doesn't go back and check again once you press the button. The paint and timer methods, on the other hand, run in every frame of the game.

Similar Threads

  1. Menu Help in TicTacToe Game
    By Ryan10 in forum New To Java
    Replies: 59
    Last Post: 04-04-2011, 05:19 AM
  2. Replies: 44
    Last Post: 10-19-2009, 08:07 PM
  3. 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
  4. Replies: 0
    Last Post: 07-07-2008, 04:47 PM
  5. Replies: 7
    Last Post: 05-09-2008, 07:54 AM

Posting Permissions

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