Done i have solved it don"t worry ^_^
Printable View
Done i have solved it don"t worry ^_^
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?
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...;;
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.