Keyboard Input - Smooth And Multiple keypress
Posted: Sun Jan 27, 2008 12:07 am
hi,
Im trying to make a ship move, and i need it to move smoothly, but now it move one bit at a time and looks really silly and bad, like a jerking motion. also how can i make it so i can press more than one key at a time so that the ship can move diagnally rather than just left then up etc..
my code is as follows:
class MyEventReceiver : public IEventReceiver
{
public:
//============================================CONTROLS================================================
virtual bool OnEvent(SEvent event)
{
if (event.KeyInput.Key == KEY_KEY_A)
{
core::vector3df v = Munch->getPosition();
v.X += -2.0f;
Munch->setPosition(v);
}
return true;
}
};
//=============================================CONTROLS END=============================================
Any help would be appreciated
regards
Im trying to make a ship move, and i need it to move smoothly, but now it move one bit at a time and looks really silly and bad, like a jerking motion. also how can i make it so i can press more than one key at a time so that the ship can move diagnally rather than just left then up etc..
my code is as follows:
class MyEventReceiver : public IEventReceiver
{
public:
//============================================CONTROLS================================================
virtual bool OnEvent(SEvent event)
{
if (event.KeyInput.Key == KEY_KEY_A)
{
core::vector3df v = Munch->getPosition();
v.X += -2.0f;
Munch->setPosition(v);
}
return true;
}
};
//=============================================CONTROLS END=============================================
Any help would be appreciated
regards