Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2007, 3:54:26 PM (17 years ago)
Author:
rennerc
Message:

Vertical playmode for SpaceShip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/world_entities/npcs/actionbox_enemy.cc

    r10657 r10662  
    4040  this->pitch = 0.0f;
    4141  this->dPitch = 0.0;
     42 
     43  this->maxSpeed = 10;
     44  this->acceleration = 3;
     45  this->speed = 0;
    4246 
    4347  if ( root )
     
    96100void ActionboxEnemy::moveTowardsBox( ActionBox * box, float dt )
    97101{
    98   Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor();
     102  //Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor();
     103  static float time = 0;
     104  time += dt;
     105  Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor() + State::getPlayer()->getPlayable()->getAbsDir().apply(Vector(1, 0, 0))*50*(1.5 + sin(time/5));
    99106  Vector targetDir = targetPos - myCoor;
    100107 
     
    127134    cur = tmp2;
    128135 
    129   myDir = cur;
     136  myDir = cur;
     137 
     138  Vector fw = cur.apply( Vector(1, 0, 0) );
     139 
     140  this->speed += this->acceleration*dt;
     141  if ( this->speed > this->maxSpeed )
     142    this->speed = this->maxSpeed;
     143  this->myCoor += fw*speed*dt;
    130144}
    131145
Note: See TracChangeset for help on using the changeset viewer.