![]() |
ArnieBoids
1.0.0
JOINT AI PROJECT
|
Bullet class. A simple bullet that moves in a direction for a lifetime. Dies if it hits something. More...
#include <Bullet.hpp>


Public Types | |
| enum | Faction { PLAYER, ENEMY } |
| Every bullet either belongs to the player or to an enemy. More... | |
Public Member Functions | |
| Bullet (sf::Vector2f const &position, sf::Vector2f const &direction, const float speed=10.f) | |
| ~Bullet () | |
| virtual void | update () |
| Moves the bullet forward and checks if it has exceeded time to live. More... | |
| bool | isActive () const |
| Is the bullet active? More... | |
| void | setActive (bool active) |
| int | getDamage () const |
| Gets the damage that the bullet will deal to something it hits. More... | |
| Faction | getFaction () const |
| void | setFaction (Faction faction) |
Protected Member Functions | |
| float | tickToSec (unsigned int ticks) const |
| Ticks to seconds. More... | |
Protected Attributes | |
| float | speed_ |
| How far the bullet travels each update. More... | |
| int | damage_ |
| How much damage a bullet does. More... | |
| unsigned int | ticks_ |
| Ticks since bullet has spawned. More... | |
| sf::Vector2f | forward_ |
| The direction or heading of the bullet. More... | |
| int | lifeTime_ |
| The number of ticks that the bullet will remain alive for. More... | |
| bool | active_ |
| True if the bullet has been fired and hasn't collided with anything. More... | |
| Faction | faction_ |
| Will be PLAYER or ENEMY, depending on who fired it. More... | |
Bullet class. A simple bullet that moves in a direction for a lifetime. Dies if it hits something.
| enum Bullet::Faction |
| Bullet::Bullet | ( | sf::Vector2f const & | position, |
| sf::Vector2f const & | direction, | ||
| const float | speed = 10.f |
||
| ) |
| Bullet::~Bullet | ( | ) |
| int Bullet::getDamage | ( | ) | const |
Gets the damage that the bullet will deal to something it hits.
| Bullet::Faction Bullet::getFaction | ( | ) | const |
| bool Bullet::isActive | ( | ) | const |
Is the bullet active?
| void Bullet::setActive | ( | bool | active | ) |
| void Bullet::setFaction | ( | Faction | faction | ) |

|
protected |
Ticks to seconds.

|
virtual |
Moves the bullet forward and checks if it has exceeded time to live.
Reimplemented in Missile.

|
protected |
True if the bullet has been fired and hasn't collided with anything.
|
protected |
How much damage a bullet does.
|
protected |
Will be PLAYER or ENEMY, depending on who fired it.
|
protected |
The direction or heading of the bullet.
|
protected |
The number of ticks that the bullet will remain alive for.
|
protected |
How far the bullet travels each update.
|
protected |
Ticks since bullet has spawned.