I'm making a class to encapsulate the main actions I´ll use in my game. This class will be the only one that access the Irrlich engine.
To add a player to the scene, I have the following method:
Code: Select all
bool CGameEngine::AddPlayerToScene (char *model,int playerID)
{
IAnimatedMesh *pMesh = pScene->getMesh(model);
if (pMesh == NULL)
return false;
IAnimatedMeshSceneNode *pNode = pScene->addAnimatedMeshSceneNode(pMesh,playersOrigin,playerID);
if (pNode == NULL)
return false;
return true;
}
Code: Select all
bool CGameEngine::SetPlayerPosition(int playerID, vector3df position)
{
ISceneNode *pNode = pScene->getSceneNodeFromId(playerID,playersOrigin);
if (pNode == NULL)
return false;
pNode->setPosition(position);
return true;
}
Is my code correct? Is there other way to do this? Help me, please.