|
R-Type
2
Doom but in better
|
Represents a bullet entity in the game. More...
#include <Bullet.hpp>


Public Member Functions | |
| Bullet (const std::uint32_t EntityId=0) | |
| Default constructor for the Bullet class. | |
| Bullet (const GUI::ECS::Components::SpriteComponent &sprite, const bool fromEnemy, const std::pair< int, int > &positionInitial, const unsigned int speed, const std::pair< int, int > &direction={ 0, -1 }, const int damage=10) | |
| Parameterized constructor for initializing a Bullet object. | |
| Bullet (const GUI::ECS::Online::Bullet &bullet) | |
| Copy constructor for Bullet. | |
| Bullet (const std::uint32_t EntityId, const GUI::ECS::Components::SpriteComponent &sprite, const bool fromEnemy, const std::pair< int, int > &positionInitial, const unsigned int speed, const std::pair< int, int > &direction={ 0, -1 }, const int damage=10) | |
| Constructor for creating a Bullet with both an Entity ID and attributes. | |
| Bullet (const std::uint32_t EntityId, const GUI::ECS::Online::Bullet &bullet) | |
| Combines entity ID and Bullet attributes from another instance. | |
| ~Bullet ()=default | |
| Default destructor for the Bullet class. | |
| void | setVisible (const bool visible) |
| Sets the visibility of the bullet. | |
| void | setPosition (const std::pair< float, float > &pos) |
| Sets the position of the bullet. | |
| void | setSprite (const GUI::ECS::Components::SpriteComponent &sprite) |
| Sets the sprite representing the bullet. | |
| void | setEnemy (const bool enemy) |
| Marks the bullet as fired by an enemy or not. | |
| void | setSpeed (const unsigned int speed) |
| Sets the speed of the bullet. | |
| void | setDirection (const std::pair< int, int > &direction) |
| Sets the direction of the bullet. | |
| void | setSize (const std::pair< float, float > &dimension) |
| Sets the size of the bullet. | |
| void | setDamage (const int damage) |
| Sets the damage dealt by the bullet. | |
| void | tick () |
| Advances the bullet's state by one tick. | |
| const GUI::ECS::Components::SpriteComponent | render () |
| Renders the bullet. | |
| const bool | isVisible () const |
| const bool | isEnemy () const |
| const std::pair< float, float > | getPosition () const |
| const bool | isColliding (const GUI::ECS::Systems::Collision &second) const |
| void | update (const GUI::ECS::Online::Bullet ©) |
| Updates the sprite by copying another Bullet. | |
| Bullet & | operator= (const GUI::ECS::Online::Bullet ©) |
| Overloads the assignment operator to copy from another Bullet. | |
| const unsigned int | getSpeed () const |
| Get the Speed at which the bullet is traveling. | |
| const GUI::ECS::Systems::Collision | getCollision () const |
| Get the Collision component. | |
| const GUI::ECS::Components::SpriteComponent | getSprite () const |
| Get the Sprite component. | |
| const std::pair< int, int > | getPositionInitial () const |
| Get the initial position that was set for the object. | |
| const int | getDamage () const |
| Get the Damage the bullet will inflict upon impact. | |
| const std::pair< int, int > | getDirection () const |
| Get the Direction in which the bullet is travelling. | |
| const std::string | getInfo (const unsigned int indent=0) const |
| This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes. | |
Public Member Functions inherited from GUI::ECS::EntityNode | |
| EntityNode (const size_t entityId=0) | |
| virtual | ~EntityNode ()=default |
| virtual size_t | getEntityNodeId () const |
Additional Inherited Members | |
Protected Attributes inherited from GUI::ECS::EntityNode | |
| size_t | _entityID |
Represents a bullet entity in the game.
Definition at line 31 of file Bullet.hpp.
| GUI::ECS::Online::Bullet::Bullet | ( | const std::uint32_t | EntityId = 0 | ) |
Default constructor for the Bullet class.
| EntityId | The unique identifier of the entity. Default is 0. |
Definition at line 16 of file Bullet.cpp.
| GUI::ECS::Online::Bullet::Bullet | ( | const GUI::ECS::Components::SpriteComponent & | sprite, |
| const bool | fromEnemy, | ||
| const std::pair< int, int > & | positionInitial, | ||
| const unsigned int | speed, | ||
| const std::pair< int, int > & | direction = { 0, -1 }, | ||
| const int | damage = 10 ) |
Parameterized constructor for initializing a Bullet object.
| sprite | The sprite representing the bullet's appearance. |
| fromEnemy | Indicates if the bullet was fired by an enemy. |
| positionInitial | The initial position of the bullet. |
| speed | The speed of the bullet. |
| direction | The direction vector of the bullet. Default is {0, -1}. |
| damage | The damage inflicted by the bullet. Default is 10. |
Definition at line 21 of file Bullet.cpp.
| GUI::ECS::Online::Bullet::Bullet | ( | const GUI::ECS::Online::Bullet & | bullet | ) |
Copy constructor for Bullet.
| bullet | The Bullet instance to copy. |
Definition at line 33 of file Bullet.cpp.
| GUI::ECS::Online::Bullet::Bullet | ( | const std::uint32_t | EntityId, |
| const GUI::ECS::Components::SpriteComponent & | sprite, | ||
| const bool | fromEnemy, | ||
| const std::pair< int, int > & | positionInitial, | ||
| const unsigned int | speed, | ||
| const std::pair< int, int > & | direction = { 0, -1 }, | ||
| const int | damage = 10 ) |
Constructor for creating a Bullet with both an Entity ID and attributes.
| EntityId | The unique identifier of the entity. |
| sprite | The sprite representing the bullet's appearance. |
| fromEnemy | Indicates if the bullet was fired by an enemy. |
| positionInitial | The initial position of the bullet. |
| speed | The speed of the bullet. |
| direction | The direction vector of the bullet. Default is {0, -1}. |
| damage | The damage inflicted by the bullet. Default is 10. |
Definition at line 27 of file Bullet.cpp.
| GUI::ECS::Online::Bullet::Bullet | ( | const std::uint32_t | EntityId, |
| const GUI::ECS::Online::Bullet & | bullet ) |
Combines entity ID and Bullet attributes from another instance.
| EntityId | The unique identifier of the entity. |
| bullet | The Bullet instance to copy attributes from. |
Definition at line 39 of file Bullet.cpp.
|
default |
Default destructor for the Bullet class.
| const GUI::ECS::Systems::Collision GUI::ECS::Online::Bullet::getCollision | ( | ) | const |
Get the Collision component.
Definition at line 207 of file Bullet.cpp.
| const int GUI::ECS::Online::Bullet::getDamage | ( | ) | const |
Get the Damage the bullet will inflict upon impact.
Definition at line 222 of file Bullet.cpp.
| const std::pair< int, int > GUI::ECS::Online::Bullet::getDirection | ( | ) | const |
Get the Direction in which the bullet is travelling.
Definition at line 227 of file Bullet.cpp.
| const std::string GUI::ECS::Online::Bullet::getInfo | ( | const unsigned int | indent = 0 | ) | const |
This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.
| indent | The level to which the class should be indented in the dump. |
Definition at line 232 of file Bullet.cpp.
| const std::pair< float, float > GUI::ECS::Online::Bullet::getPosition | ( | ) | const |
Definition at line 129 of file Bullet.cpp.
| const std::pair< int, int > GUI::ECS::Online::Bullet::getPositionInitial | ( | ) | const |
Get the initial position that was set for the object.
Definition at line 217 of file Bullet.cpp.
| const unsigned int GUI::ECS::Online::Bullet::getSpeed | ( | ) | const |
Get the Speed at which the bullet is traveling.
Definition at line 202 of file Bullet.cpp.
| const GUI::ECS::Components::SpriteComponent GUI::ECS::Online::Bullet::getSprite | ( | ) | const |
Get the Sprite component.
Definition at line 212 of file Bullet.cpp.
| const bool GUI::ECS::Online::Bullet::isColliding | ( | const GUI::ECS::Systems::Collision & | second | ) | const |
Definition at line 139 of file Bullet.cpp.
| const bool GUI::ECS::Online::Bullet::isEnemy | ( | ) | const |
Definition at line 124 of file Bullet.cpp.
| const bool GUI::ECS::Online::Bullet::isVisible | ( | ) | const |
Definition at line 119 of file Bullet.cpp.
| GUI::ECS::Online::Bullet & GUI::ECS::Online::Bullet::operator= | ( | const GUI::ECS::Online::Bullet & | copy | ) |
Overloads the assignment operator to copy from another Bullet.
| copy | The Bullet to copy data from. |
Definition at line 196 of file Bullet.cpp.
| const GUI::ECS::Components::SpriteComponent GUI::ECS::Online::Bullet::render | ( | ) |
Renders the bullet.
Definition at line 114 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::setDamage | ( | const int | damage | ) |
Sets the damage dealt by the bullet.
| damage | The amount of damage. |
Definition at line 84 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::setDirection | ( | const std::pair< int, int > & | direction | ) |
Sets the direction of the bullet.
| direction | A pair of integers representing the direction vector. |
Definition at line 73 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::setEnemy | ( | const bool | enemy | ) |
Marks the bullet as fired by an enemy or not.
| enemy | True if the bullet belongs to an enemy, false otherwise. |
Definition at line 63 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::setPosition | ( | const std::pair< float, float > & | pos | ) |
Sets the position of the bullet.
| pos | The new position as a pair of floats. |
Definition at line 52 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::setSize | ( | const std::pair< float, float > & | dimension | ) |
Sets the size of the bullet.
| dimension | A pair of floats representing width and height. |
Definition at line 78 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::setSpeed | ( | const unsigned int | speed | ) |
Sets the speed of the bullet.
| speed | The speed value. |
Definition at line 68 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::setSprite | ( | const GUI::ECS::Components::SpriteComponent & | sprite | ) |
Sets the sprite representing the bullet.
| sprite | The new sprite component. |
Definition at line 58 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::setVisible | ( | const bool | visible | ) |
Sets the visibility of the bullet.
| visible | True if the bullet should be visible, false otherwise. |
Definition at line 46 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::tick | ( | ) |
Advances the bullet's state by one tick.
Definition at line 89 of file Bullet.cpp.
| void GUI::ECS::Online::Bullet::update | ( | const GUI::ECS::Online::Bullet & | copy | ) |
Updates the sprite by copying another Bullet.
| copy | The Bullet to copy data from. |
Definition at line 176 of file Bullet.cpp.