src/Projectile.hh
author nireco
Sun, 07 Dec 2008 18:23:18 +0000
changeset 248 e40ef56dc62c
parent 233 ff4ecea83cf5
child 252 25054ce94d07
permissions -rw-r--r--
scrolling looks like it works
#ifndef PROJECTILE_HH
#define PROJECTILE_HH
 
class Projectile;

#include "GameState.hh"
#include "PhysicsObject.hh"
#include "Timer.hh"
#include "GraphicsPointer.hh"

class Projectile : public PhysicsObject {
protected:
    GameState &state;
    bool visible;
    bool target_visible;
    float radius;

public:
    TickCount birth_tick;
    TickCount age;

    Projectile (GameState &state, Vector position, Vector velocity, bool visible, float radius, TickCount age=1000000000);
    virtual ~Projectile (void);

    virtual void draw (Graphics *g, Vector camera = Vector(0, 0)) const;

protected:
    /*
     * Removes ground at given position if applicable, and destroys this PhysicsObject.
     *
     * This is overriden by Network.
     */
    virtual void onDestroy (Vector position, bool removeGround);
    
    /*
     * Call onDestroy, removingGround
     */
    virtual void onCollision (void);

    /*
     * If we have expired, call onDestory without removingGround
     */
    virtual void tick (TimeMS dt);
};
 
#endif