cirno-puzzle/src/hero.h

48 lines
935 B
C
Raw Normal View History

2020-02-19 12:50:09 -05:00
#ifndef HERO_H
#define HERO_H
#include "entity.h"
2020-02-20 13:34:41 -05:00
enum class Direction
{
2020-02-21 09:13:12 -05:00
Left,
Up,
Right,
Down,
None
2020-02-20 13:34:41 -05:00
};
/// Represents a controlable by player game character
class Hero : public Entity
2020-02-19 12:50:09 -05:00
{
private:
int hero_charges;
bool on_exit;
2020-02-19 12:50:09 -05:00
public:
2020-02-21 09:13:12 -05:00
explicit Hero(coordinate position_x = 0, coordinate position_y = 0, int initial_charges = 0);
2020-02-20 13:34:41 -05:00
/// 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-25 11:53:57 -05:00
/// Set amount of hero charges explicitly
void setCharges(int charges) noexcept;
2020-02-20 13:34:41 -05:00
/// Move hero by one cell to any direction
2020-02-21 09:13:12 -05:00
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;
2020-02-19 12:50:09 -05:00
};
#endif // HERO_H