Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 30, 2006, 12:51:58 PM (18 years ago)
Author:
bensch
Message:

AimingTurret is better suited for network, as the projectiles are not connected to anything.
also it makes the game a little bit easier, and more fun as the turrets move around :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/world_entities/weapons/aiming_turret.cc

    r9406 r9615  
    3838*/
    3939AimingTurret::AimingTurret ()
    40   : Weapon()
     40  : Weapon(), target(this)
    4141{
    4242  this->init();
     
    4646
    4747AimingTurret::AimingTurret(const TiXmlElement* root)
     48  : target(this)
    4849{
    4950  this->init();
     
    9192  //this->getProjectileFactory()->prepare(100);
    9293
    93   this->target = new Aim(this);
    94   this->target->setVisibility(false);
    95   this->target->setRange(400);
    96   this->target->setAngle(M_PI_2);
     94  this->target.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE);
     95  this->target.setVisibility(false);
     96  this->target.setRange(400);
     97  this->target.setAngle(M_PI_2);
    9798
    9899  this->setActionSound(WA_SHOOT, "sound/explosions/explosion_3.wav");
     
    110111void AimingTurret::activate()
    111112{
    112   this->target->setVisibility(true);
     113  this->target.setVisibility(true);
    113114}
    114115
    115116void AimingTurret::deactivate()
    116117{
    117   this->target->setVisibility(false);
     118  this->target.setVisibility(false);
    118119}
    119120
     
    123124    return;
    124125  Quaternion quat;
    125   Vector direction = this->target->getAbsCoor() - this->getAbsCoor();
     126  Vector direction = this->target.getAbsCoor() - this->getAbsCoor();
    126127
    127128  direction.normalize();
     
    134135  this->setAbsDirSoft(quat, 5);
    135136
    136   this->target->tick(dt);
     137  this->target.tick(dt);
    137138}
    138139
     
    144145
    145146  pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
    146             /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
     147            /*target.getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    147148
    148149  pj->setParent(PNode::getNullParent());
Note: See TracChangeset for help on using the changeset viewer.