コード例 #1
0
ファイル: gradius.c プロジェクト: bcherry/bcherry
inline void moveLaser(POSITION oldPos, POSITION newPos) {
	eraseLaser(oldPos);
	drawLaser(newPos);
}
コード例 #2
0
void GunTurret::updateLasers(float elapsedtime/*, MapLoader& m_map, Player& p*/)
{
    m_lasergentime += elapsedtime;
    m_lasersit = m_lasers.begin();
    //bool switchhit = false;
    while (m_lasersit != m_lasers.end())
    {
        //cout << "Number of lasers: " << m_lasers.size();
        Laser* l = *m_lasersit;
        Vector3 pos = l->getPosition();
        //Vector3 startpos = l->getStartPosition();
        //pos = pos - startpos;
        if (2500.0f > fabs(pos.x()))
            if(2500.0f > fabs(pos.y()))
                if (2500.0f > fabs(pos.z()))
                {
                    Vector3 planenormal;
                    //if (m_map.checkLaserCollision(l->getBbox(), l->getDirection(), switchhit, planenormal, p, false))
                    //{
                    //    if (17.5 > l->getLifeTime() && !switchhit)
                    //    {
                    //        //Create scorch mark at the spot of the laser
                    //        createScorchMark(l->getPosition(), -planenormal);
                    //    }
                    //    //Setup particle system when laser hits something
                    //    ParticleSystemManager* psm = getWriteableGameResource()->getParticleSystemManager();
                    //    ParticleEmitter* pe = psm->createEmitter(l->getPosition(), planenormal);
                    //    pe->setMaxParticles(5.0f);
                    //    pe->setEmissionRate(5.0f);
                    //    pe->setParticleStartColor(Color::red());
                    //    pe->setParticleKey1Color(Color::red());
                    //    pe->setParticleKey2Color(Color::red());
                    //    pe->setParticelEndColor(Color::red());
                    //    pe->setParticleKey1Pos(0.33f);
                    //    pe->setParticleKey2Pos(0.66f);
                    //    pe->setParticleLifetime(1.0f);
                    //    pe->setLifeTime(1.0f);
                    //    pe->setParticleSize(0.75f);
                    //    pe->setStartVelocity(7.5f);
                    //    pe->setSpreadAngle(90.0f);
                    //    pe->setAlive(true);
                    //    //MSG_TRACE_CHANNEL("", sizeof(ParticleEmitter) << endl;
                    //    eraseLaser(m_lasersit, l);
                    //    continue;
                    //}
                    //l->move(elapsedtime);
                    m_lasersit++;
                }
                else
                    eraseLaser(m_lasersit, l);
            else
                eraseLaser(m_lasersit, l);
        else
            eraseLaser(m_lasersit, l);
    }
    m_scorchit = m_scorchmarks.begin();
    while (m_scorchit != m_scorchmarks.end())
    {
        //cout << "Number of lasers: " << m_lasers.size();
        ScorchMark* sm = *m_scorchit;
        if (sm->getLifetime() < 0.0f)
        {
            delete sm;
            m_scorchit = m_scorchmarks.erase(m_scorchit);
            continue;
        }
        //sm->move(elapsedtime); update of the scorch mark takes care of this
        m_scorchit++;
    }
}
コード例 #3
0
ファイル: blaster.c プロジェクト: bcherry/bcherry
// a function that moves the cannon, by erasing and redrawing
inline void moveLaser(POSITION oldPos, POSITION newPos, int map_x_location) {
    eraseLaser(oldPos, map_x_location);
    drawLaser(newPos, map_x_location);
}