Projectile (entity)#

This class defines a Projectile Entity. Currently, it is only instantiated in the KeyboardController component, in a not very generic call.

As of now, not very generic. Eventually, it would be ideal to be able to have multiple animations per projectile (beginning, flying and ending, though the beginning one might be included in the Player/Enemy entity shooting animation instead).

As of now, all projectiles have the collision_handle::CollisionHandle::DESTROY collider tag.

Typedefs

using vec = Eigen::Vector2f
struct Projectile : public Entity#
#include <Projectile.hpp>

Projectile Entity.

Public Functions

Projectile(Manager &man, std::string name, vec position, float speed, vec velocity, std::string sprite_name, float sprite_scale, float damage, int rng, Entity *owner = nullptr)#

Constructor

Parameters:
  • rng – The range of the projectile before it is destroyed (in pixels).

  • owner – The Entity that has shot the projectile. This is passed to the Damage component’s immune vector (so that entity cannot hit itself).

virtual void update() override#

Default update function: updates each component.

Public Members

int range#

How far it the projectile will go before being deleted.

int distance#

How far the projectile has travelled so far.