/*! \projectile.h \brief a projectile, that is been shooted by a weapon You can use this class to make some shoots, but this isn't the real idea. If you want to just test, if the shooting funcions work, use the Projectile class. But if you want to implement your own shoots its different:
Make a new class and derive it from Projectile. To have a weapon work well, reimplement the functions - void tick() - void draw() - void hit() (only if you have working collision detection) When you have implemented these functions you have just to add the projectiles to your weapon. You ll want to make this by looking into the function - Weapon::fire() there you just change the line: Projectile* pj = new Projectile(); TO Projectile* pj = new MyOwnProjectileClass(); and schwups it works... :) */ #ifndef _PROJECTILE_H #define _PROJECTILE_H #include "world_entity.h" class Vector; class Weapon; class Projectile : public WorldEntity { friend class World; public: Projectile (Weapon* weapon); virtual ~Projectile (); void setFlightDirection(Quaternion flightDirection); void setSpeed(float speed); void setTTL(float ttl); virtual void hit (WorldEntity* weapon, Vector* loc); virtual void destroy (); virtual void tick (float time); virtual void draw (); protected: //physical attriutes like: force, speed, acceleration etc. float speed; //!< this is the speed of the projectile float currentLifeTime; //!< this is the time, the projectile exists in this world (incremented by tick) float ttl; //!< time to life, after this time, the projectile will garbage collect itself Vector* flightDirection; //!< direction in which the shoot flights Weapon* weapon; //!< weapon the shoot belongs to }; #endif /* _PROJECTILE_H */