Merge branch 'master' of github.com:ralucado/WaveGGJ17
This commit is contained in:
commit
dd656cbc60
8 changed files with 20 additions and 8 deletions
BIN
Resources/Sounds/Fails/1.wav
Normal file
BIN
Resources/Sounds/Fails/1.wav
Normal file
Binary file not shown.
Binary file not shown.
|
@ -39,5 +39,5 @@ void main(void) {
|
||||||
|
|
||||||
vec4 color = vec4(255, 120, 153, 255) / 255.;
|
vec4 color = vec4(255, 120, 153, 255) / 255.;
|
||||||
vec4 colorB = vec4(255,255,255,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.;
|
||||||
}
|
}
|
|
@ -29,10 +29,15 @@ bool Actor::update(float deltaTime, sf::RenderWindow *window) {
|
||||||
return this->updateLogic(deltaTime, window);
|
return this->updateLogic(deltaTime, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Actor::hitBy(Compas enemy) const {
|
bool Actor::hitBy(Compas enemy) {
|
||||||
if (enemy == compas) std::cout << "dodge" << std::endl;
|
bool hit = enemy == compas;
|
||||||
|
if (hit) std::cout << "dodge" << std::endl;
|
||||||
else std::cout << "hit" << 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 {
|
Compas Actor::getAttack() const {
|
||||||
|
|
|
@ -12,7 +12,7 @@ public:
|
||||||
Actor(int num);
|
Actor(int num);
|
||||||
bool update(float deltaTime, sf::RenderWindow *window);
|
bool update(float deltaTime, sf::RenderWindow *window);
|
||||||
void draw(sf::RenderWindow *window);
|
void draw(sf::RenderWindow *window);
|
||||||
bool hitBy(Compas enemy) const;
|
bool hitBy(Compas enemy);
|
||||||
Compas getAttack() const;
|
Compas getAttack() const;
|
||||||
virtual bool event(sf::Event e, bool def) = 0;
|
virtual bool event(sf::Event e, bool def) = 0;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ void Combat::initShader() {
|
||||||
void Combat::update(float deltaTime, sf::RenderWindow *window) {
|
void Combat::update(float deltaTime, sf::RenderWindow *window) {
|
||||||
player->update(deltaTime, window);
|
player->update(deltaTime, window);
|
||||||
bool aux = enemy->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;
|
time += deltaTime;
|
||||||
|
|
||||||
_shader.setParameter("time", time);
|
_shader.setParameter("time", time);
|
||||||
|
@ -53,6 +53,7 @@ void Combat::updateEvents(sf::Event e) {
|
||||||
if (playerOneTurn) {
|
if (playerOneTurn) {
|
||||||
bool aux = player->event(e, !attacking);
|
bool aux = player->event(e, !attacking);
|
||||||
if (!aux) { //end of player one ritm
|
if (!aux) { //end of player one ritm
|
||||||
|
|
||||||
if (!attacking) {
|
if (!attacking) {
|
||||||
if(!player->hitBy(enemy->getAttack())) {
|
if(!player->hitBy(enemy->getAttack())) {
|
||||||
scoreEnemy->incrisScore();
|
scoreEnemy->incrisScore();
|
||||||
|
|
|
@ -2,12 +2,15 @@
|
||||||
#include "mygame.hpp"
|
#include "mygame.hpp"
|
||||||
|
|
||||||
Menu::Menu() {
|
Menu::Menu() {
|
||||||
_start.setPosition(5,5);
|
_start.setPosition(512-160,200);
|
||||||
_exit.setPosition(100,100);
|
_exit.setPosition(512-160,400);
|
||||||
_start.turnOn();
|
_start.turnOn();
|
||||||
_exit.turnOn();
|
_exit.turnOn();
|
||||||
_buttons.push_back(&_start);
|
_buttons.push_back(&_start);
|
||||||
_buttons.push_back(&_exit);
|
_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){
|
void Menu::draw(sf::RenderWindow* window){
|
||||||
|
window->draw(background);
|
||||||
for(unsigned int i = 0; i < _buttons.size(); ++i){
|
for(unsigned int i = 0; i < _buttons.size(); ++i){
|
||||||
window->draw(*_buttons[i]);
|
window->draw(*_buttons[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ class Menu : public Scene{
|
||||||
Button _start = Button(WORK_DIR+"Resources/play-spreadsheet.png");
|
Button _start = Button(WORK_DIR+"Resources/play-spreadsheet.png");
|
||||||
Button _exit = Button(WORK_DIR+"Resources/exit-spreadsheet.png");
|
Button _exit = Button(WORK_DIR+"Resources/exit-spreadsheet.png");
|
||||||
std::vector<Button*> _buttons;
|
std::vector<Button*> _buttons;
|
||||||
|
sf::Texture textureBackground;
|
||||||
|
sf::Sprite background;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MENU_HPP
|
#endif // MENU_HPP
|
||||||
|
|
Reference in a new issue