cirno-puzzle/hero.h

40 lines
719 B
C
Raw Normal View History

2020-02-19 12:50:09 -05:00
#ifndef HERO_H
#define HERO_H
2020-02-20 13:34:41 -05:00
enum class Direction
{
LEFT,
UP,
RIGHT,
DOWN,
NONE
};
/// Represents a controlable by player game character
2020-02-19 12:50:09 -05:00
class Hero
{
private:
int hero_charges;
2020-02-20 13:34:41 -05:00
int pos_x, pos_y;
2020-02-19 12:50:09 -05:00
public:
2020-02-20 13:34:41 -05:00
explicit Hero(int position_x = 0, int position_y = 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;
2020-02-19 12:50:09 -05:00
2020-02-20 13:34:41 -05:00
/// Spend one charge on action
bool useCharge();
2020-02-19 12:50:09 -05:00
2020-02-20 13:34:41 -05:00
/// Get current Hero position
void position(int &x, int &y) const noexcept;
2020-02-19 12:50:09 -05:00
2020-02-20 13:34:41 -05:00
/// Move hero by one cell to any direction
void move(Direction &direction);
2020-02-19 12:50:09 -05:00
};
#endif // HERO_H