Merge branch 'master' of github.com:ralucado/WaveGGJ17

This commit is contained in:
marti.lloveras 2017-01-21 18:24:11 +01:00
commit dd656cbc60
8 changed files with 20 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View file

@ -39,5 +39,5 @@ void main(void) {
vec4 color = vec4(255, 120, 153, 255) / 255.;
vec4 colorB = vec4(255,255,255,255)/ 255.;
gl_FragColor = (grid(fract(uv))) * color;
gl_FragColor = (grid(fract(uv))) * color - line(umuv.y, 0., 0.175, 0.025) * color * 2.;
}

View file

@ -29,10 +29,15 @@ bool Actor::update(float deltaTime, sf::RenderWindow *window) {
return this->updateLogic(deltaTime, window);
}
bool Actor::hitBy(Compas enemy) const {
if (enemy == compas) std::cout << "dodge" << std::endl;
bool Actor::hitBy(Compas enemy) {
bool hit = enemy == compas;
if (hit) std::cout << "dodge" << std::endl;
else std::cout << "hit" << std::endl;
return enemy == compas;
if (!hit) {
character->setState(PlayerState::hurt);
animate = PlayerState::inMidle;
}
return hit;
}
Compas Actor::getAttack() const {

View file

@ -12,7 +12,7 @@ public:
Actor(int num);
bool update(float deltaTime, sf::RenderWindow *window);
void draw(sf::RenderWindow *window);
bool hitBy(Compas enemy) const;
bool hitBy(Compas enemy);
Compas getAttack() const;
virtual bool event(sf::Event e, bool def) = 0;

View file

@ -35,7 +35,7 @@ void Combat::initShader() {
void Combat::update(float deltaTime, sf::RenderWindow *window) {
player->update(deltaTime, window);
bool aux = enemy->update(deltaTime, window);
if (ia) enemyManager(aux); //end of player two ia ritm
if (ia) enemyManager(aux); //end of player two ia rythm
time += deltaTime;
_shader.setParameter("time", time);
@ -53,6 +53,7 @@ void Combat::updateEvents(sf::Event e) {
if (playerOneTurn) {
bool aux = player->event(e, !attacking);
if (!aux) { //end of player one ritm
if (!attacking) {
if(!player->hitBy(enemy->getAttack())) {
scoreEnemy->incrisScore();

View file

@ -2,12 +2,15 @@
#include "mygame.hpp"
Menu::Menu() {
_start.setPosition(5,5);
_exit.setPosition(100,100);
_start.setPosition(512-160,200);
_exit.setPosition(512-160,400);
_start.turnOn();
_exit.turnOn();
_buttons.push_back(&_start);
_buttons.push_back(&_exit);
ASSERT(textureBackground.loadFromFile(WORK_DIR+"Resources/background.png"));
background.setTexture(textureBackground);
background.setPosition(0,0);
}
@ -21,6 +24,7 @@ void Menu::update(float deltaTime, sf::RenderWindow*window){
}
void Menu::draw(sf::RenderWindow* window){
window->draw(background);
for(unsigned int i = 0; i < _buttons.size(); ++i){
window->draw(*_buttons[i]);
}

View file

@ -17,6 +17,8 @@ class Menu : public Scene{
Button _start = Button(WORK_DIR+"Resources/play-spreadsheet.png");
Button _exit = Button(WORK_DIR+"Resources/exit-spreadsheet.png");
std::vector<Button*> _buttons;
sf::Texture textureBackground;
sf::Sprite background;
};
#endif // MENU_HPP