treewars/player.cpp

30 lines
397 B
C++

#include "player.h"
Player::Player(string name, unsigned int colour)
{
this->name = name;
this->colour = colour;
energy = 50;
}
void Player::add_energy(unsigned int amount)
{
energy += amount;
}
bool Player::spend_energy(unsigned int amount)
{
if (amount > energy) return false;
energy -= amount;
return true;
}
void Player::set_played()
{
played = true;
}