Planet
navihomeaboutscreenshotsdownloaddevelopmentforum

archive/Projectile

Projectile

Error: Failed to load processor ArchivePage
No macro or processor named 'ArchivePage' found

A Baseclass for all the Projectiles/Bullets that one might imagne. A Projectile is most of the Time emitted by a Weapon.

Dependecies

Projectiles get emitted by Weapon. Weapons give them their impuls, their live, and mainly all the essential initial values. From there on, they are on their own, and fly through space searching for something to destroy and initiate the ~ operator ...

  • types:
    1. Rockets
    2. Lasers
    3. Projectiles (Metallic or Metalloplastic)
    4. Bombs
    5. Joining (like the linking-gun of some other games...)
    6. other doomsdaydevice-equal destruction Methods
    7. Zero Point Gravity/Black Hole

Implementation

Here follows a listing of the most important Functions of this Class:

    void setFlightDirection(const Quaternion& flightDirection);
    void setVelocity(const Vector &velocity);
    void setLifeSpan(float lifeSpan);


    void setEnergies(float energyMin, float energyMax);

    /** @brief This is called, when the Projectile is Emitted */
    virtual void activate() = 0;
    /** @brief This is called, when the Projectile is being destroyed, or deleted */
    virtual void deactivate() = 0;

    virtual void destroy ();

    virtual void tick (float time);
    virtual void draw () const;

Projectile Creation

Creating Projectiles is a rather easy process, but if you like, Projecties can be extremely extendable. For instance, if you liked some Gravitation gun (not the one from HL2), then you would connect a physical field to the Gun, that sucks in all NPC's and if they are to near, distroy them (or damage them about some amount).

Description

  1. Have a look at the creation-howto of WorldEntity
  2. Make the class public Projectile? instead of public WorldEntity (include projectile.h instead of world_entity.h)
  3. Graphics: probably the most important part about the creation of a Projectile -> OpenGL
  4. Special Actions, etc