However, I did run into another problem with it.
static bool isWalking = false; //at the top of the header
Code: Select all
bool OnEvent(SEvent event)
{
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == KEY_ESCAPE)
{
device->closeDevice();
return true;
}
else
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == KEY_KEY_E)
{
isWalking == true;
return true;
}
return false;
}
Theres the event receiver
Code: Select all
playermesh = smgr->getMesh("media/rahhmd2.md2");
playermeshn = smgr->addAnimatedMeshSceneNode(playermesh);
playermeshn->setMaterialTexture(0, driver->getTexture("media/evil.pcx"));
playermeshn->setPosition(vector3df(0,45,0));
playermeshn->setScale(vector3df(2.0f,2.0f,2.0f));
if(!isWalking){playermeshn->setMD2Animation(EMAT_STAND);}
if(isWalking){playermeshn->setMD2Animation(EMAT_RUN);}
playermeshn->addShadowVolumeSceneNode();
evil1wep2 = smgr->getMesh("media/weapon.md2");
evil1wepn2 = smgr->addAnimatedMeshSceneNode(evil1wep2, playermeshn, 1, vector3df(0,0,0));
evil1wepn2->setMaterialTexture(0, driver->getTexture("media/weapon.pcx"));
if(!isWalking){evil1wepn2->setMD2Animation(EMAT_STAND);}
evil1wepn2->addShadowVolumeSceneNode();
Theres where I load up a mesh.
For some reason when the E key is pressed, nothing happens.
It should trigger the isWalking to true and cause the EMAT_RUN animation to play, however it just remains in stand.