src/Projectile.hh
changeset 276 87434abc1ba1
parent 272 97de051edbcf
child 283 7540b0859579
equal deleted inserted replaced
275:fa44b905bc2e 276:87434abc1ba1
     9 #include "GraphicsPointer.hh"
     9 #include "GraphicsPointer.hh"
    10 
    10 
    11 class Projectile : public PhysicsObject {
    11 class Projectile : public PhysicsObject {
    12 protected:
    12 protected:
    13     /**
    13     /**
    14      * Reference to the world that we live in
    14      * Which player fired this projectile?
    15      */
    15      */
    16     GameState &state;
    16     Player *player;
    17 
    17 
    18     /**
    18     /**
    19      * Projectiles can be inivisble, e.g. for digging
    19      * Projectiles can be inivisble, e.g. for digging
    20      */
    20      */
    21     bool visible;
    21     bool visible;
    40      */
    40      */
    41     TickCount birth_tick;
    41     TickCount birth_tick;
    42 
    42 
    43 public:
    43 public:
    44     /**
    44     /**
    45      * Construct a Projectile using the given parameters and add it to the world's list of projectiles
    45      * Constructs this projectile using the given position/velocity, pulling the rest of the parameter values from the
       
    46      * given weapon. The given player is assigned to this projectile. 
    46      */
    47      */
    47     Projectile (GameState &state, Vector position, Vector velocity, float explosionRadius, float radius,
    48     Projectile (Player *player, Vector position, Vector velocity, Weapon *weapon, bool visible = true);
    48             TickCount expire, bool visible = true);
       
    49 
       
    50     /**
       
    51      * Like above, but using the parameters of the given weapon
       
    52      *
       
    53      * @see Projectile
       
    54      */
       
    55     Projectile (GameState &state, Vector position, Vector velocity, Weapon *weapon, bool visible = true);
       
    56 
    49 
    57     /**
    50     /**
    58      * Removes this from the world's list of projectiles
    51      * Removes this from the world's list of projectiles
    59      */
    52      */
    60     virtual ~Projectile (void);
    53     virtual ~Projectile (void);
    63      * Draw
    56      * Draw
    64      */
    57      */
    65     virtual void draw (Graphics *g, PixelCoordinate camera) const;
    58     virtual void draw (Graphics *g, PixelCoordinate camera) const;
    66 
    59 
    67 protected:
    60 protected:
    68     /**
       
    69      * Initialize shape and add to world projectiles list
       
    70      */
       
    71     void initialize (void);
       
    72 
       
    73     /**
    61     /**
    74      * Removes ground at given position if applicable, and destroys this PhysicsObject.
    62      * Removes ground at given position if applicable, and destroys this PhysicsObject.
    75      *
    63      *
    76      * This is overriden by Network.
    64      * This is overriden by Network.
    77      */
    65      */