This repository has been archived on 2022-12-14. You can view files and clone it, but cannot push or open issues or pull requests.
WaveGGJ17/VaporWaveWars/actor.cpp
2017-01-21 13:32:20 +01:00

32 lines
840 B
C++

#include "actor.hpp"
Actor::Actor() {}
Actor::Actor(int num) {
animate = PlayerState::attacking;
this->character = new Character(num);
}
void Actor::draw(sf::RenderWindow *window) {
window->draw(*character);
}
bool Actor::update(float deltaTime, sf::RenderWindow *window) {
character->update(deltaTime);
if (animate == PlayerState::attacking) {
character->setState(PlayerState::attacking);
animate = PlayerState::inMidle;
}
else if (animate == PlayerState::inMidle) {
if (character->isLastFrame()) animate = PlayerState::idle;
}
return this->updateLogic(deltaTime, window);
}
void Actor::hitBy(Compas enemy) const {
if (enemy == compas) std::cout << "dodge" << std::endl;
else std::cout << "hit" << std::endl;
}
Compas Actor::getAttack() const {
return compas;
}