Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9615 in orxonox.OLD for branches/proxy/src/world_entities/weapons


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 :)

Location:
branches/proxy/src/world_entities/weapons
Files:
2 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());
  • branches/proxy/src/world_entities/weapons/aiming_turret.h

    r8777 r9615  
    88
    99#include "weapon.h"
    10 
     10#include "aim.h"
    1111/* FORWARD DECLARATION */
    12 class Aim;
    1312
    1413class AimingTurret : public Weapon
    15   {
    16   public:
    17     AimingTurret ();
    18     AimingTurret(const TiXmlElement* root);
    19     virtual ~AimingTurret ();
     14{
     15public:
     16  AimingTurret ();
     17  AimingTurret(const TiXmlElement* root);
     18  virtual ~AimingTurret ();
    2019
    21     void init();
    22     virtual void loadParams(const TiXmlElement* root);
     20  virtual void loadParams(const TiXmlElement* root);
    2321
    24     virtual void activate();
    25     virtual void deactivate();
     22  void setTargetGroup(OM_LIST targetGroup) { this->target.setTargetGroup(targetGroup); };
    2623
    27     virtual void tick(float dt);
    28     virtual void fire();
     24  virtual void activate();
     25  virtual void deactivate();
     26
     27  virtual void tick(float dt);
     28  virtual void fire();
    2929
    3030
    31     virtual void draw() const;
     31  virtual void draw() const;
    3232
    33   private:
    34     Aim*          target;
    35   };
     33private:
     34  void init();
     35
     36private:
     37  Aim           target;
     38};
    3639
    3740#endif /* _AIMING_TURRET_H */
Note: See TracChangeset for help on using the changeset viewer.