Game Development Reference
In-Depth Information
/** The maximum relative velocity of this firework. */
cyclone::Vector3 maxVelocity;
/** The damping of this firework type. */
cyclone::real damping;
/**
* The payload is the new firework type to create when this
* firework's fuse is over.
*/
struct Payload
{
/** The type of the new particle to create. */
unsigned type;
/** The number of particles in this payload. */
unsigned count;
};
/** The number of payloads for this firework type. */
unsigned payloadCount;
/** The set of payloads. */
Payload *payloads;
};
Rules are provided in the code, and they are defined in one function that controls
the behavior of all possible fireworks. This is a sample of that function:
Excerpt from src/demos/fireworks/fireworks.cpp
void FireworksDemo::initFireworkRules()
{
// Go through the firework types and create their rules.
rules[0].setParameters(
1, // type
3, 5, // age range
cyclone::Vector3(-5, -5, -5), // min velocity
cyclone::Vector3(5, 5, 5), // max velocity
0.1 // damping
);
// ... and so on for other firework types ...
}
Search Nedrilad ::




Custom Search