Results 1 to 4 of 4
  1. #1
    fresh83 is offline Member
    Join Date
    Dec 2009
    Posts
    55
    Rep Power
    0

    Default Timed response button

    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?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,932
    Rep Power
    8

    Default

    Which part of this are you stuck on?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    fresh83 is offline Member
    Join Date
    Dec 2009
    Posts
    55
    Rep Power
    0

    Default

    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

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default

    how to make a method that when called makes a button appear for only 2 seconds.
    How to Use Swing Timers (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Other Swing Features)

    This is all inside a while(gameisalive=true) loop
    It is never needed to compare a boolean with true or false.
    Java Code:
    //  while(gameisalive=true)
     while(gameisalive)
    
    // while(gameisalive=false)
     while(!gameisalive)
    db

Similar Threads

  1. Replies: 0
    Last Post: 04-07-2011, 03:09 PM
  2. javamail, Connection timed out
    By OmerHalit in forum Networking
    Replies: 11
    Last Post: 04-12-2010, 07:02 AM
  3. Connection Timed Out
    By sukatoa in forum Networking
    Replies: 2
    Last Post: 10-27-2009, 03:20 PM
  4. solution for connection timed out
    By santhosh_el in forum Networking
    Replies: 0
    Last Post: 10-03-2009, 07:55 AM
  5. i am getting connection timed out
    By santhosh_el in forum Networking
    Replies: 1
    Last Post: 08-25-2009, 06:57 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
  •