Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3709 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Apr 1, 2005, 1:45:47 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: implemented TestBullet

Location:
orxonox/trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/test_bullet.cc

    r3708 r3709  
    1717
    1818
    19 #include "simple_bullet.h"
     19#include "test_bullet.h"
    2020
    2121#include "world_entity.h"
     
    3131   \brief standard constructor
    3232*/
    33 SimpleBullet::SimpleBullet (Weapon* weapon) : WorldEntity()
     33TestBullet::TestBullet (Weapon* weapon) : WorldEntity()
    3434{}
    3535
     
    3838   \brief standard deconstructor
    3939*/
    40 SimpleBullet::~SimpleBullet ()
     40TestBullet::~TestBullet ()
    4141{
    4242  /*
     
    4848
    4949
    50 /**
    51    \brief this sets the flight direction of the projectile
    52    \param directin in which to flight
    53 
    54    this function will calculate a vector out of this to be used in the
    55    tick function
    56 */
    57 void SimpleBullet::setFlightDirection(Quaternion flightDirection)
    58 {
    59   if( this->flightDirection == NULL)
    60     this->flightDirection = new Vector();
    61   Vector v(1, 0, 0);
    62   *this->flightDirection = flightDirection.apply(v);
    63   this->flightDirection->normalize();
    64 }
    65 
    66 
    67 /**
    68    \brief this sets the time to life of the projectile
    69    \param ttl in second
    70 
    71    after this life time, the projectile will garbage collect itself
    72 */
    73 void SimpleBullet::setTTL(float ttl)
    74 {
    75   this->ttl = ttl;
    76 }
    77 
    78 
    79 /**
    80    \brief sets the speed of the projectile
    81 */
    82 void SimpleBullet::setSpeed(float speed)
    83 {
    84   this->speed = speed * 3; /* fix speed settings */
    85   PRINTF(4)("SimpleBullet::setting speed to: %f\n", this->speed);
    86 }
    8750
    8851/**
     
    9053   \param time since last tick
    9154*/
    92 void SimpleBullet::tick (float time)
     55void TestBullet::tick (float time)
    9356{
    9457  Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.7);
     
    11174   \param place where it is hit
    11275*/
    113 void SimpleBullet::hit (WorldEntity* entity, Vector* place)
     76void TestBullet::hit (WorldEntity* entity, Vector* place)
    11477{}
    11578
     
    11881   \brief the function gets called, when the projectile is destroyed
    11982*/
    120 void SimpleBullet::destroy ()
     83void TestBullet::destroy ()
    12184{}
    12285
    12386
    124 void SimpleBullet::draw ()
     87void TestBullet::draw ()
    12588{
    12689  glMatrixMode(GL_MODELVIEW);
  • orxonox/trunk/src/world_entities/test_bullet.h

    r3708 r3709  
    44*/
    55
    6 #ifndef _PROJECTILE_H
    7 #define _PROJECTILE_H
     6#ifndef _TEST_BULLET_H
     7#define _TEST_BULLET_H
    88
    99#include "world_entity.h"
     
    1212class Weapon;
    1313
    14 class Projectile : public WorldEntity
     14class TestBullet : public Projectile
    1515{
    1616  friend class World;
    1717
    1818 public:
    19   Projectile (Weapon* weapon);
    20   virtual ~Projectile ();
    21 
    22   void setFlightDirection(Quaternion flightDirection);
    23   void setSpeed(float speed);
    24   void setTTL(float ttl);
     19  TestBullet (Weapon* weapon);
     20  virtual ~TestBullet ();
    2521
    2622  virtual void hit (WorldEntity* weapon, Vector* loc);
     
    2925  virtual void tick (float time);
    3026  virtual void draw ();
    31 
    32  private:
    33   //physical attriutes like: force, speed, acceleration etc.
    34   float speed;                         //!< this is the speed of the projectile
    35   float currentLifeTime;               //!< this is the time, the projectile exists in this world (incremented by tick)
    36   float ttl;                           //!< time to life, after this time, the projectile will garbage collect itself
    37   Vector* flightDirection;             //!< direction in which the shoot flights
    38   Weapon* weapon;                      //!< weapon the shoot belongs to
    3927 
    4028};
    4129
    42 #endif /* _PROJECTILE_H */
     30#endif /* _TEST_BULLET_H */
Note: See TracChangeset for help on using the changeset viewer.