I was a little confused by the layout, sorry!I would like to know if someone could look at my code and hopefully suggest a solution. I have been trying to apply a keyboard movement system (Like W S A D) to my game for 2 days now and no success. It's a simple system (not the best either)...
Code:
if( GTH_CanMove() && g_pApp->m_myCharacter->isAlive)
{
if( g_input->KeyEvent( DIK_NUMPAD8 ) )
{
g_pApp->m_myCharacter->event = GTH_EV_CHAR_MOUSERUN;
}
else if( g_input->KeyEvent( DIK_NUMPAD5 ) )
{
g_pApp->m_myCharacter->event = GTH_EV_CHAR_MOUSEWALK;
}
else if( g_input->KeyEvent( DIK_NUMPAD6 ) )
{
g_pApp->m_myCharacter->event = GTH_EV_CHAR_RUNRIGHT;
}
else if( g_input->KeyEvent( DIK_NUMPAD4 ) )
{
g_pApp->m_myCharacter->event = GTH_EV_CHAR_RUNLEFT;
}
else if( g_input->KeyEvent( DIK_NUMPAD3 ) )
{
g_pApp->m_myCharacter->event = GTH_EV_CHAR_WALKRIGHT;
}
else if( g_input->KeyEvent( DIK_NUMPAD1 ) )
{
g_pApp->m_myCharacter->event = GTH_EV_CHAR_WALKLEFT;
}
else
{
g_pApp->m_myCharacter->event = GTH_EV_CHAR_IDLE;
}
}
Any help would be much appreciated. If you would like to look at the code in more detail then please do not hesitate to ask
Thank you!
