Thread: bioskey

  1. #1
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44

    Question bioskey

    A friend of mine and I are making a snake game and getch doesnt seem to be working as a control scheme (it stops the program and waits for input, whereas we need it to continue even if they dont input anything) I remember when Ihsir posted his "aim" game he mentioned that he used bioskey instead of getch. I was wondering if using this would solve our problem, and if you can even use it in MS VC++... If it could, a tutorial of some sort would be much appreciated.
    "No! I must have my delicious cupcakes, my sweet cakey treasures, piping hot from their 40 watt WOMB!!!"
    --Captain Murphy

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    bioskey is no longer used...

    use _kbhit().
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44
    Unfortunately that puts me exactly where i was: nowhere.
    "No! I must have my delicious cupcakes, my sweet cakey treasures, piping hot from their 40 watt WOMB!!!"
    --Captain Murphy

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    what about trying
    while(_kbhit())
    {}

    So the loop only executes when a key is hit.

  5. #5
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    bioskey will also wait for a keypress. i think try what lambs4 suggests.

    i think that to have independent movement of 2 or more things it might require some complicated programming.

    you could also check the FAQs or somewhere else on the site for the snake game. I vaguely remember it is there with the code.
    Last edited by ihsir; 01-18-2002 at 04:03 AM.

  6. #6
    Ethereal Raccoon Procyon's Avatar
    Join Date
    Aug 2001
    Posts
    189
    You can also try something like

    Code:
    while {
      ...
      if (kbhit()) inputchar = getch();
      ...
    }
    Then the loop will execute, but if the user hits a key it will appear in the variable inputchar. You can then put if statements in the code depending on what inputchar is. This is what I usually do.

    Also, some compilers have other functions than kbhit() that do the same thing in its place - check the relevent help file.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Here's my tic-tac-toe game
    By ihsir in forum Game Programming
    Replies: 14
    Last Post: 12-31-2001, 06:15 PM
  2. bioskey() - please help me out
    By Leeman_s in forum C++ Programming
    Replies: 1
    Last Post: 12-23-2001, 10:19 AM