Limit on amount of keypresses?
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
Limit on amount of keypresses?
It seems like there's a limit to the number of keyboard events you can test at once. Although it wouldn't make since based on what I have implemented. I have a movement system and that has jumping support. But when you try to jump when traveling in the up/left direction. It doesn't register a keypress. I'll post code later.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: Limit on amount of keypresses?
This is an issue of your keyboard, try another one.
Please read about the keyboard switch matrix.
Please read about the keyboard switch matrix.
"Whoops..."
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
hmm
Yeah but if I do the same in the up/right direction it works fine.
here's my code
that moves the character,
that rotates,
here's my code
Code: Select all
//{straight
if ( receiver.IsKeyDown(KEY_UP) )
{
irrSimplePhysics->addObjectUserForce(ipObject, vector3df( +move_speed * vecForce.X, irrSimplePhysics->getGravity().Y , +move_speed * vecForce.Z ) );
}
if ( receiver.IsKeyDown(KEY_DOWN) )
{
irrSimplePhysics->addObjectUserForce(ipObject, vector3df( -move_speed * vecForce.X, irrSimplePhysics->getGravity().Y , -move_speed * vecForce.Z ) );
}
//}
//{side
if ( receiver.IsKeyDown(KEY_RIGHT) )
{
irrSimplePhysics->addObjectUserForce(ipObject, vector3df( +move_speed * vecForceSide.X, irrSimplePhysics->getGravity().Y , +move_speed * vecForceSide.Z ) );
}
if ( receiver.IsKeyDown(KEY_LEFT) )
{
irrSimplePhysics->addObjectUserForce(ipObject, vector3df( -move_speed * vecForceSide.X, irrSimplePhysics->getGravity().Y , -move_speed * vecForceSide.Z ) );
}
//}
Code: Select all
//{rotation
if ( receiver.IsKeyDown(KEY_UP) )
{
render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y-180 , 0 ) );
}
if ( receiver.IsKeyDown(KEY_RIGHT) )
{
render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y-90 , 0 ) );
}
if ( receiver.IsKeyDown(KEY_LEFT) )
{
render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y+90 , 0 ) );
}
if ( receiver.IsKeyDown(KEY_DOWN) )
{
render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y , 0 ) );
}
if ( receiver.IsKeyDown(KEY_RIGHT) && receiver.IsKeyDown(KEY_UP) )
{
render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y-135 , 0 ) );
}
if ( receiver.IsKeyDown(KEY_LEFT) && receiver.IsKeyDown(KEY_UP) )
{
render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y+135 , 0 ) );
}
if ( receiver.IsKeyDown(KEY_RIGHT) && receiver.IsKeyDown(KEY_DOWN) )
{
render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y-45 , 0 ) );
}
if ( receiver.IsKeyDown(KEY_LEFT) && receiver.IsKeyDown(KEY_DOWN) )
{
render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y+45 , 0 ) );
}
//}
Code: Select all
if ( receiver.IsKeyDown(KEY_SPACE) && jump_key_flag == true )
{
irrSimplePhysics->setObjectUserForce(ipObject, vector3df( 0 , jump_str , 0 ) );
jump_key_flag = false;
}
if ( receiver.IsKeyDown(KEY_SPACE) == false )
{
jump_key_flag = true;
}
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
uh oh
How can I fix it then? It still happens if I comment out the rotation stuff to. And not when I move in either up/right or down/left directions.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
joystick
Well it works with my joystick. So it's definitely a keyboard problem.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
Enter?
Should I just put in the option of using ENTER to jump also? I know on
another PC SPACE works pretty well (the keyboard's wired different).
another PC SPACE works pretty well (the keyboard's wired different).
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
a post that might help you out: http://www.idevgames.com/forum/showthread.php?p=145203
Worlds at War (Current Project) - http://www.awkward-games.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
This problem has existed as long as standard pc keyboards have.
It used to be really annoying playing Mortal Kombat 3 with 2 players on one keyboard, holding certain keys (like a diagonal jump) would block your opponent from doing certain attacks.
Some keyboards handle it better than others. The Razer Lycosa keyboard is designed so the WASD keys don't block other nearby keys, and the Razer Tarantula keyboard claims on it's feature page to allow up to 10 keys to be help at once before they start blocking each other.
The only way to avoid it (apart from using a game controller instead of a keyboard) is to use try different keys, or buy a different model of keyboard and hope. Since keyboards can handle this differently, a key combo that works for one person could fail for another.
It used to be really annoying playing Mortal Kombat 3 with 2 players on one keyboard, holding certain keys (like a diagonal jump) would block your opponent from doing certain attacks.
Some keyboards handle it better than others. The Razer Lycosa keyboard is designed so the WASD keys don't block other nearby keys, and the Razer Tarantula keyboard claims on it's feature page to allow up to 10 keys to be help at once before they start blocking each other.
The only way to avoid it (apart from using a game controller instead of a keyboard) is to use try different keys, or buy a different model of keyboard and hope. Since keyboards can handle this differently, a key combo that works for one person could fail for another.