Final Game Project
Assigned: 2007/12/24
Due: 2008/01/14
Based the results from homework #1 - #4, you need add the following features to complete your final term project :
- Add combat FXs.
- Add sound FXs.
- Add UI to show the life of the player.
Hints & Suggestions :
- The usage of TheFly FX system :
- Include FyFx.h in your code to use the FX system.
- To create and load a FX :
- To play the FX in the timer callback:
- Please handle the usage of the FX carefully. To make the system resource usage more effective, you can use two scenes to manage the FX playing. One scene is your game scene which is always used for rendering. Another one is a scene (backup scene) to load the FX and clone the FX for the using in game. When loading the FX into backup scene, if the game needs to use the loaded FX, you can clone (using eF3DFX->Clone) the FX, and then switch the FX to the rendering scene to play it. When the FX finished the playing of the FX, you can delete it or switch back to backup for feature using. The following is the sample code to do it.
- To play the FX at the specific position, query the base object of the FX system and put the base object to the specific position.
// load an FX file
eF3DFX *fx00;
fx00 = new eF3DFX(sID2); // create an empty FX object
fx00->SetWorkPath(”Data\\FX”); // set the working path of the FX
BOOL beOK = fx00->Load(”test01″); // load the test01.cfx
if (!beOK) {
// echo the error message
…
}
fx00->Reset() // reset the FX to frame 0
if (fx00 != NULL) {
BOOL beOK = fx00->Play((float) skip); // play next frame
if (!beOK) { // if beOK = FALSE, the playing is finished.
… // handle the finish of the playing
}
}
// load an FX file to the backup scene (sID2)
fx00 = new eF3DFX(sID2);
fx00->SetWorkPath(”Data\\FX”);
BOOL beOK = fx00->Load(”test01″);
// clone a FX (fx01) and switch it to rendering scene (sID)
fx01 = fx00->Clone();
fx01->SwitchScene(sID);
…
if (fx01 != NULL) {
BOOL beOK = fx01->Play((float) skip);
if (!beOK) {
delete fx01;
fx01 = NULL;
}
}
OBJECTid baseID = fx01->GetBaseObject();
FnObject base;
base.Object(baseID);
base.Translate(50.0f, 0.0f, 40.0f, REPLACE);