#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0

    How To Get Input From Spacebar


    I am going to make a space invaders game in C.
    I know how to make it but i don't know how to
    make it so that if you press the spacebar it executes a if statement this is what i mean

    Code:
               
    if(ch=='Spacebar ') <------ how do i do this
    {
    /*..........................*/
    }
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    The space character is ' ', AKA '\x20', AKA 32.

    I assume by your question that you have already worked out how to not have to wait for the Enter key to be pressed.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    26
    Rep Power
    0
    Thanks so much also I know how to make it so that you dont need to press enter

IMN logo majestic logo threadwatch logo seochat tools logo