Most of the code in the shoot() function will be redundant as all you are really trying to do is create a FlyStraightAnimator with the correct parameters.
All the parameters you need will be in the calling function, CGamePlayState::MouseEvent().
In your shoot fuction you just need to do the //create fireball and //set flight line bit to start with.
You might want to pass in a pointer to the GameManager, pManager. You can then get a pointer to Irrlicht subsytems like the SceneManager (sm) in the code you have like this :
to create a FlyStraightAnimator you can do this:
Code: Select all
pManager->getSceneManager()->createFlystraightAnimator(camPos,targetPos, 5000);
to get the first parameter, camPos:
Code: Select all
pManager->getSceneManager()->getActiveCamera()->getPosition()
and the second, the target position, wall or enemy (getTargetsPosition() is a member function of CGamePlayState() by the looks)
and so on.
Sorry it's only high level help, but I think in this case it's better to step back from the code and think what you want to achieve from it. Then start from a blank and build it up rather than cut and paste a large amount of code and then whittle it back.
________
Avatar: the last airbender forum