You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
921 B
C++

#ifndef HERO_H
#define HERO_H
#include "entity.h"
enum class Direction
{
Left,
Up,
Right,
Down,
None
};
/// Represents a controlable by player game character
class Hero : public Entity
{
private:
int hero_charges;
bool on_exit;
public:
explicit Hero(coordinate row = 0, coordinate col = 0, int initial_charges = 0);
/// Add more charges for hero to use
void refillCharges(int append_charges);
/// Get amount of charges
int charges() const noexcept;
/// Spend one charge on action
bool useCharge();
/// Set amount of hero charges explicitly
void setCharges(int charges) noexcept;
/// Move hero by one cell to any direction
void move(const Direction &direction);
/// Sets on_exit flag to true, game will load next level
void reachExit() noexcept;
/// Are we exiting level?
bool onExit() const noexcept;
};
#endif // HERO_H