diff --git a/Resources/shader.frag b/Resources/shader.frag index 7844480..bd71d03 100644 --- a/Resources/shader.frag +++ b/Resources/shader.frag @@ -5,19 +5,23 @@ float rand(vec2 n) { return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); } -float line(float p, float x, float glow) { - if (abs(p - x) < 0.025) return 1.; +float line(float p, float x, float glow, float thick) { + if (abs(p - x) < thick) return 1.; + return 1. - pow(abs(p - x), glow); +} + +float line2(float p, float x, float glow) { return 1. - pow(abs(p - x), glow); } float grid(vec2 uv) { float glow = 0.05; - float c = line(uv.x, 0.25, glow) + line(uv.x, 0.75, glow) - + line(uv.x, 0.5, glow) - + line(uv.x, 0.0, glow) + line(uv.x, 1.0, glow) - + line(uv.y, 0.25, glow) + line(uv.y, 0.75, glow) - + line(uv.y, 0.5, glow) - + line(uv.y, 0.0, glow) + line(uv.y, 1.0, glow); + float c = line(uv.x, 0.25, glow, 0.025) + line(uv.x, 0.75, glow, 0.025) + + line(uv.x, 0.5, glow, 0.025) + + line(uv.x, 0.0, glow, 0.025) + line(uv.x, 1.0, glow, 0.025) + + line(uv.y, 0.25, glow, 0.025) + line(uv.y, 0.75, glow, 0.025) + + line(uv.y, 0.5, glow, 0.025) + + line(uv.y, 0.0, glow, 0.025) + line(uv.y, 1.0, glow, 0.025); return c; } @@ -34,5 +38,6 @@ void main(void) { else uv.y -= abs(time * 0.1); vec4 color = vec4(255, 120, 153, 255) / 255.; + vec4 colorB = vec4(255,255,255,255)/ 255.; gl_FragColor = (grid(fract(uv))) * color; } \ No newline at end of file diff --git a/VaporWaveWars/combat.cpp b/VaporWaveWars/combat.cpp index 884cecc..b169993 100644 --- a/VaporWaveWars/combat.cpp +++ b/VaporWaveWars/combat.cpp @@ -51,7 +51,7 @@ void Combat::draw(sf::RenderWindow *window) { void Combat::updateEvents(sf::Event e) { if (playerOneTurn) { - bool aux = player->event(e); + bool aux = player->event(e, !attacking); if (!aux) { //end of player one ritm if (!attacking) { if(!player->hitBy(enemy->getAttack())) { @@ -63,7 +63,7 @@ void Combat::updateEvents(sf::Event e) { } } else if (!ia) { - bool aux = !enemy->event(e); + bool aux = !enemy->event(e, !attacking); enemyManager(aux); //end of player two not ia ritm } } diff --git a/VaporWaveWars/compas.cpp b/VaporWaveWars/compas.cpp index ce941da..18a2253 100644 --- a/VaporWaveWars/compas.cpp +++ b/VaporWaveWars/compas.cpp @@ -25,10 +25,10 @@ void Compas::add() { void Compas::end() { if (isPress) { isPress = false; - std::cout << "end" << std::endl; - for (int i = 0; i < notes.size(); ++i) { - std::cout << notes[i] << std::endl; - } +// std::cout << "end" << std::endl; +// for (int i = 0; i < notes.size(); ++i) { +// std::cout << notes[i] << std::endl; +// } } } diff --git a/VaporWaveWars/player.cpp b/VaporWaveWars/player.cpp index ed296a2..e2042bd 100644 --- a/VaporWaveWars/player.cpp +++ b/VaporWaveWars/player.cpp @@ -21,7 +21,7 @@ bool Player::updateLogic(float deltaTime, sf::RenderWindow *window) { return false; } -bool Player::event(sf::Event e) { +bool Player::event(sf::Event e, bool def) { switch(e.type) { case (sf::Event::KeyPressed): if(e.key.code == sf::Keyboard::C) { @@ -35,9 +35,8 @@ bool Player::event(sf::Event e) { } else { compas.end(); - error = true; //weird? + error = true; if (animate != PlayerState::inMidle) animate = PlayerState::hurt; - } } break; diff --git a/VaporWaveWars/player.hpp b/VaporWaveWars/player.hpp index 3286532..487efa7 100644 --- a/VaporWaveWars/player.hpp +++ b/VaporWaveWars/player.hpp @@ -8,7 +8,7 @@ class Player : public Actor { public: Player(); Player(int num); - bool event(sf::Event e) final override; + bool event(sf::Event e, bool def) final override; protected: bool updateLogic(float deltaTime, sf::RenderWindow *window);