| | 1 | = Projectile = |
| | 2 | [[ArchivePage]] |
| | 3 | |
| | 4 | A Baseclass for all the Projectiles/Bullets that one might imagne. |
| | 5 | A Projectile is most of the Time emitted by a [wiki:archive/Weapon Weapon]. |
| | 6 | |
| | 7 | __Dependecies__ |
| | 8 | * [wiki:archive/WorldEntity WorldEntity] |
| | 9 | * [wiki:archive/Weapon Weapon] |
| | 10 | * !FastFactory |
| | 11 | |
| | 12 | |
| | 13 | '''Projectiles''' get emitted by [wiki:archive/Weapon Weapon]. ''Weapons'' give them their impuls, their live, and mainly all the essential __initial values__. |
| | 14 | From there on, they are on their own, and fly through space searching for something to destroy and initiate the '''~''' operator ... |
| | 15 | * '''types''': |
| | 16 | 1. Rockets |
| | 17 | 1. Lasers |
| | 18 | 1. Projectiles (Metallic or Metalloplastic) |
| | 19 | 1. Bombs |
| | 20 | 1. Joining (like the linking-gun of some other games...) |
| | 21 | 1. other doomsdaydevice-equal destruction Methods |
| | 22 | 1. Zero Point Gravity/Black Hole |
| | 23 | |
| | 24 | == Implementation == |
| | 25 | Here follows a listing of the most important Functions of this Class: |
| | 26 | {{{ |
| | 27 | #!cpp |
| | 28 | void setFlightDirection(const Quaternion& flightDirection); |
| | 29 | void setVelocity(const Vector &velocity); |
| | 30 | void setLifeSpan(float lifeSpan); |
| | 31 | |
| | 32 | |
| | 33 | void setEnergies(float energyMin, float energyMax); |
| | 34 | |
| | 35 | /** @brief This is called, when the Projectile is Emitted */ |
| | 36 | virtual void activate() = 0; |
| | 37 | /** @brief This is called, when the Projectile is being destroyed, or deleted */ |
| | 38 | virtual void deactivate() = 0; |
| | 39 | |
| | 40 | virtual void destroy (); |
| | 41 | |
| | 42 | virtual void tick (float time); |
| | 43 | virtual void draw () const; |
| | 44 | }}} |
| | 45 | |
| | 46 | == Projectile Creation == |
| | 47 | Creating Projectiles is a rather easy process, but if you like, Projecties can be extremely extendable. |
| | 48 | 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). |
| | 49 | |
| | 50 | __Description__ |
| | 51 | 1. Have a look at the creation-howto of [wiki:archive/WorldEntity WorldEntity] |
| | 52 | 2. Make the class '''public [wiki:Projectile Projectile]''' instead of ''public [wiki:archive/WorldEntity WorldEntity]'' (include projectile.h instead of world_entity.h) |
| | 53 | 3. Graphics: probably the most important part about the creation of a Projectile -> OpenGL |
| | 54 | 4. Special Actions, etc |