Jagguar Game Engine

Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ProjectileComponent Class Reference

`#include <ProjectileComponent.hpp>`

Inheritance diagram for ProjectileComponent:
[legend]
Collaboration diagram for ProjectileComponent:
[legend]

## Public Member Functions
| ProjectileComponent (RigidbodyComponent *_projectile, TransformComponent *_target, bool _homing, float _var)
| ~ProjectileComponent ()
void | Update (SDL_Event e, int frame, std::vector< std::string > broadcastList) override
void | Render (SDL_Renderer *ren) override
Public Member Functions inherited from Component
| Component ()
| ~Component ()
virtual void | Update (SDL_Event e, int frame, std::vector< std::string > broadcastList)
virtual void | Render (SDL_Renderer *ren)
virtual void | ShowComponentEditor (bool *showEditor)
virtual bool | HasTag (ComponentTag t)
virtual const char * | ComponentTypeName ()
void | ParseAndUpdateBroadcast (std::vector< std::string > broadcastList)

## Private Attributes
RigidbodyComponent * | projectile
TransformComponent * | target
bool | homing
float | speed
float | angle
float | gravity = 10

## Additional Inherited Members
Protected Attributes inherited from Component
std::vector< ComponentTag > | tags
std::vector< std::string > | previousBroadcasts
std::vector< std::string > | pendingBroadcasts

## Detailed Description

A Component implementation to treat a GameObject as a projectile.

## Constructor & Destructor Documentation

## ◆ ProjectileComponent()

ProjectileComponent::ProjectileComponent | ( | RigidbodyComponent * | _projectile,
|  | TransformComponent * | _target,
|  | bool | _homing,
|  | float | _var
| ) |  |

Construct a new Projectile Component object.

Parameters

  _projectile | the RigidbodyComponent of the parent GameObject
  _target | the TransformComponent of the target the Projectile is fired at
  _homing | whether the ProjectileComponent will seek out the target
  _var | if homing, the speed of the projectile. Otherwise, the angle the ProjectileComponent is fired at

Here is the call graph for this function:

## ◆ ~ProjectileComponent()

ProjectileComponent::~ProjectileComponent | ( |  | ) |

Destroy the Projectile Component object

## Member Function Documentation

## ◆ Render()

void ProjectileComponent::Render | ( | SDL_Renderer * | ren | ) |
| override virtual

Renders the component (if it has anything to render)

Parameters

  ren | the SDL renderer to be displayed upon

See also
  IGraphicsEngineRenderer

Reimplemented from Component.

## ◆ Update()

void ProjectileComponent::Update | ( | SDL_Event | e,
|  | int | frame,
|  | std::vector< std::string > | broadcastList
| ) |  |
| override virtual

Updates the state of the component object. Called by the Engine every tick

Parameters

  e | any inputs given by the user
  frame | what frame is the game currently displaying
  broadcastList | a list to be used to send messages between components

See also
  ParseAndUpdateBroadcast()

Reimplemented from Component.

Here is the call graph for this function:

## Member Data Documentation

## ◆ homing

bool ProjectileComponent::homing
| private

the TransformComponent being attacked

The documentation for this class was generated from the following files:

- include/ProjectileComponent.hpp
- src/ProjectileComponent.cpp