I need to create a method preferably in android but seeing the logic of it done in java would also be helpful.
When called the method needs to create a button and give the user 2 seconds to respond or it's game over.
Any suggestions?
Printable View
I need to create a method preferably in android but seeing the logic of it done in java would also be helpful.
When called the method needs to create a button and give the user 2 seconds to respond or it's game over.
Any suggestions?
Which part of this are you stuck on?
I guess I'm stumped on how to make a method that when called makes a button appear for only 2 seconds.
It's part of a bigger game that has 3 buttons and when started the game will generate a random number and then that number will be checked against 3 if statements that go something like if(randnumb=1){
Make button 1 appear for 2 seconds.}
This is all inside a while(gameisalive=true) loop
Not pressing the correct button in time results in gameisalive=false and pressing the button keeps the game alive of course.at least this was my bestshot as to how it should be designed. Any help or suggestions would be beyond helpful.I'm completely on my own when it comes to programming and I'm sure a lot of u know what that's like
How to Use Swing Timers (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Other Swing Features)Quote:
how to make a method that when called makes a button appear for only 2 seconds.
It is never needed to compare a boolean with true or false.Quote:
This is all inside a while(gameisalive=true) loop
dbCode:// while(gameisalive=true)
while(gameisalive)
// while(gameisalive=false)
while(!gameisalive)