Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2014, 3:05:46 PM (10 years ago)
Author:
fvultier
Message:

new items added. improved level generator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickupsFS14/src/modules/jump/JumpProjectile.cc

    r10050 r10074  
    5656        RegisterObject(JumpProjectile);
    5757
    58         this->figure_ = 0;
     58        figure_ = 0;
    5959
    60         this->registerVariables();
     60        registerVariables();
    6161
    62         this->setPosition(Vector3(0,0,0));
    63         this->setVelocity(Vector3(0,0,0));
    64         this->setAcceleration(Vector3(0,0,0));
     62        setPosition(Vector3(0,0,0));
     63        setVelocity(Vector3(0,0,250.0));
     64        setAcceleration(Vector3(0,0,0));
    6565    }
    6666
     
    108108        SUPER(JumpProjectile, tick, dt);
    109109
    110         Vector3 platformPosition = this->getPosition();
     110        Vector3 projectilePosition = getPosition();
    111111
    112         if (figure_ != NULL)
    113         {
    114             Vector3 figurePosition = figure_->getPosition();
    115             Vector3 figureVelocity = figure_->getVelocity();
     112                for (ObjectList<JumpEnemy>::iterator it = ObjectList<JumpEnemy>::begin(); it != ObjectList<JumpEnemy>::end(); ++it)
     113                {
     114                        Vector3 enemyPosition = it->getPosition();
     115                        float enemyWidth = it->getWidth();
     116                        float enemyHeight = it->getHeight();
    116117
    117             if(figureVelocity.z < 0 && figurePosition.x > platformPosition.x-10 && figurePosition.x < platformPosition.x+10 && figurePosition.z > platformPosition.z-4 && figurePosition.z < platformPosition.z+4)
    118             {
    119                 touchFigure();
    120             }
    121         }
     118                        if(projectilePosition.x > enemyPosition.x-enemyWidth && projectilePosition.x < enemyPosition.x+enemyWidth && projectilePosition.z > enemyPosition.z-enemyHeight && projectilePosition.z < enemyPosition.z+enemyHeight)
     119                        {
     120                                it->dead_ = true;
     121                        }
     122                }
    122123    }
    123124
     
    128129        An array (of size 2) of weak pointers, to be set as the new bats.
    129130    */
    130     void JumpProjectile::setFigure(WeakPtr<JumpFigure> newFigure)
     131    void JumpProjectile::setFigure(WeakPtr<JumpFigure> figure)
    131132    {
    132         figure_ = newFigure;
    133     }
    134 
    135     void JumpProjectile::accelerateFigure()
    136     {
    137 
    138     }
    139 
    140     void JumpProjectile::touchFigure()
    141     {
    142 
     133        figure_ = figure;
    143134    }
    144135}
Note: See TracChangeset for help on using the changeset viewer.