Odpovědět keyboard input help

  • Wednesday, August 29, 2012 11:32 AM
     
     

    Hello, i am making a text window blackjack and i cant quite figure out how how to get the programe to register specefic key input, for example the user would press D to deal, S to stick etc. any ideas ?

All Replies

  • Wednesday, August 29, 2012 12:26 PM
     
     Answered Has Code

    You could use the TextWindow.ReadKey() function, here's a little example :

    readkey = TextWindow.ReadKey()
    If readkey = "s" Then
      ' Do something here
    ElseIf readkey = "d" Then
      'Do something else
    Else
      'Everything else here
    EndIf

  • Wednesday, August 29, 2012 12:33 PM
     
     

    ahhh that is perfect, thank you.

    however, is there anyway i could get the computer to deal the cards without the user having to hit enter to continue ?

  • Wednesday, August 29, 2012 5:07 PM
    Moderator
     
     
    There is no key press event for the TextWindow, but there is for the GraphicsWindow - you could do it in the GraphicsWindow, putting text for the game in a textbox and maybe even add some graphics - just another option.
  • Wednesday, August 29, 2012 6:30 PM
    Answerer
     
     Answered

    I really wished SB had some kinda TextWindow.InKey().  *_*

    TextWindow.ReadKey(), albeit useful in many situations, it halts program execution and can't be used in games!


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)