continuous key pressing technique

This is a discussion on continuous key pressing technique within the Game Programming forums, part of the General Programming Boards category; I've seen some action fighting games and really impress with their technique of combine keys to generate different moves. So ...

  1. #1
    Computer guy
    Join Date
    Sep 2005
    Location
    I'm lost!!!
    Posts
    200

    continuous key pressing technique

    I've seen some action fighting games and really impress with their technique of combine keys to generate different moves. So do those techniques require time period or something like that?
    Hello, testing testing. Everthing is running perfectly...for now

  2. #2
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    I would guess that the code would do something like this:
    Code:
    if(keydown['A'] && keydown['B']) {
       do_cool_fighting_move();
    }
    Of course you'd have to do extra checking when you check the other keys to make sure you don't do 2 things at once.

  3. #3
    Banned SniperSAS's Avatar
    Join Date
    Aug 2005
    Posts
    175
    Quote Originally Posted by joeprogrammer
    I would guess that the code would do something like this:
    Code:
    if(keydown['A'] && keydown['B']) {
       do_cool_fighting_move();
    }
    Of course you'd have to do extra checking when you check the other keys to make sure you don't do 2 things at once.
    In most fighting games you hit a series of buttons in a row and not all at once to do a special move which is alot more complicated I think

    You would probably need an arrayof ints to store how long ago the button was hit, this will allow us not only to see if the button was hit a certain number of cycles ago, but also check to make sure the buttons were hit in the proper sequence

    Code:
    int KeyTime[256];
    then then when we do our input checking...

    Code:
    if(Keys[VK_UP])
    {
        KeyTime[VK_UP] = 0;
    }
    then each cycle:

    Code:
    if(PastKeys[VK_UP] != -1)
    {
        KeyTime[VK_UP]++;
    }
    if(KeyTime[VK_UP] > 50)
    {
        KeyTime[VK_UP] = -1;
    }
    let's just act like 50 was what we chose to be the max number of cycles in between button hits if the player was trying to launch a combo, the smaller it gets the harder it would be to pull off the combo, and the bigger the easier

    Code:
    if(PastKeys[VK_UP] != -1 && KeyTime[VK_LEFT] < KeyTime[VK_UP] && KeyTime['A'] < KeyTime[VK_LEFT)
    {
        FireBall();
    }
    so if i hit up then left then 'a' my character would launch a fire ball and kill yours

  4. #4
    Computer guy
    Join Date
    Sep 2005
    Location
    I'm lost!!!
    Posts
    200
    Thanks guys. Sure it does look complicated.
    Hello, testing testing. Everthing is running perfectly...for now

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 05:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 05:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21