Exemple #1
0
// |----------------------------------------------------------------------------|
// |							   Initialize									|
// |----------------------------------------------------------------------------|
bool Player::Initialize() {
    GameObject::Initialize();

	// Set up ship
	Graphic* graphic = new Graphic;
    graphic->SetTint(1.0f,1.0f,1.0f,1.0f);
    graphic->SetShader("Texture");
    graphic->SetShader("Light");
	graphic->SetTexture("shiptexture");
    graphic->SetModel("ship");
    graphic->SetScale(Coord(0.01f,0.01f,0.01f));
	graphic->SetReflectiveness(0.95f);
    graphic->Initialize();
    m_ship = new GameObject;
    m_ship->Initialize();
	m_ship->SetGraphic(graphic);
    m_ship->SetPosition(Coord(0.0f,0.0f,0.0f));
    m_ship->SetOrientation(Coord(0.0f,0.0f,0.0f));

    // Set up left thruster
    m_leftThruster = new ParticleSystem;
    m_leftThruster->Initialize();
    graphic = new Billboard;
    graphic->SetShader("Texture");
    graphic->SetTexture("fireball");
    graphic->SetAlphaBlend(true);
    graphic->SetScale(Coord(0.003f,0.003f,0.003f));
    graphic->Initialize();
    m_leftThruster->SetGraphic(graphic);
    m_leftThruster->SetPosition(Coord(-0.6f,0.0f,-0.7f));
    m_leftThruster->SetParticleVelocity(Coord(0.0f,0.0f,-2.0f));
    m_leftThruster->SetParticleVelocityVariation(Coord(0.5f,0.5f,0.5f));
    m_leftThruster->SetParticleSpawnFrequency(0.01f);
    m_leftThruster->SetParticleDeviation(Coord(0.0f,0.0f,0.0f));
    m_leftThruster->SetParticleLifetime(0.5f);
    m_leftThruster->SetParticleFadeout(0.2f);
    m_leftThruster->SetMaxParticles(100);
    m_leftThruster->SetTint(0.8f,0.9f,1.0f);
    m_leftThruster->SetTintVar(0.2f,0.2f,0.2f);

    // Set up right thruster
    m_rightThruster = new ParticleSystem;
    m_rightThruster->Initialize();
    graphic = new Billboard;
    graphic->SetShader("Texture");
    graphic->SetTexture("fireball");
    graphic->SetAlphaBlend(true);
    graphic->SetScale(Coord(0.003f,0.003f,0.003f));
    graphic->Initialize();
    m_rightThruster->SetGraphic(graphic);
    m_rightThruster->SetPosition(Coord(0.6f,0.0f,-0.7f));
    m_rightThruster->SetParticleVelocity(Coord(0.0f,0.0f,-2.0f));
    m_rightThruster->SetParticleVelocityVariation(Coord(0.5f,0.5f,0.5f));
    m_rightThruster->SetParticleSpawnFrequency(0.001f);
    m_rightThruster->SetParticleDeviation(Coord(0.0f,0.0f,0.0f));
    m_rightThruster->SetParticleLifetime(0.5f);
    m_rightThruster->SetParticleFadeout(0.2f);
    m_rightThruster->SetMaxParticles(100);
    m_rightThruster->SetTint(0.8f,0.9f,1.0f);
    m_rightThruster->SetTintVar(0.2f,0.2f,0.2f);



	DebugLog ("Player: object initialized.");
	return true;
}