-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectile.h
More file actions
40 lines (31 loc) · 1.09 KB
/
Projectile.h
File metadata and controls
40 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef PROJECTILE_H
#define PROJECTILE_H
#include <SFML/Graphics.hpp>
#include <cmath>
#include "Entity.h"
// Class representing a projectile in the game
class Projectile : public Entity
{
private:
int damage; // Damage dealt by the projectile
public:
// Default constructor
Projectile();
// Parameterized constructor
// Inputs: radius, position, color, speed, destination, isPlayer, damage
Projectile(int r, sf::Vector2f position, sf::Color Colour, float speed,
sf::Vector2f destination, bool isPlayer, int damage);
// Returns "projectile"
// Output: string "projectile"
std::string getType() override;
// Returns the damage dealt by the projectile
// Output: damage value
int getDamage();
// Handles collision with another entity
// Inputs: pointer to another Entity object
void handleCollision(Entity *entity);
// Moves the projectile towards its destination by speed units
// Overrides the move function from Entity, marking the projectile for destruction if it reaches its destination
void move() override;
};
#endif