def diferent
This commit is contained in:
parent
bdc23b64e4
commit
8276d66807
5 changed files with 22 additions and 18 deletions
|
@ -5,19 +5,23 @@ float rand(vec2 n) {
|
||||||
return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);
|
return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);
|
||||||
}
|
}
|
||||||
|
|
||||||
float line(float p, float x, float glow) {
|
float line(float p, float x, float glow, float thick) {
|
||||||
if (abs(p - x) < 0.025) return 1.;
|
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);
|
return 1. - pow(abs(p - x), glow);
|
||||||
}
|
}
|
||||||
|
|
||||||
float grid(vec2 uv) {
|
float grid(vec2 uv) {
|
||||||
float glow = 0.05;
|
float glow = 0.05;
|
||||||
float c = line(uv.x, 0.25, glow) + line(uv.x, 0.75, 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)
|
+ line(uv.x, 0.5, glow, 0.025)
|
||||||
+ line(uv.x, 0.0, glow) + line(uv.x, 1.0, glow)
|
+ line(uv.x, 0.0, glow, 0.025) + line(uv.x, 1.0, glow, 0.025)
|
||||||
+ line(uv.y, 0.25, glow) + line(uv.y, 0.75, glow)
|
+ line(uv.y, 0.25, glow, 0.025) + line(uv.y, 0.75, glow, 0.025)
|
||||||
+ line(uv.y, 0.5, glow)
|
+ line(uv.y, 0.5, glow, 0.025)
|
||||||
+ line(uv.y, 0.0, glow) + line(uv.y, 1.0, glow);
|
+ line(uv.y, 0.0, glow, 0.025) + line(uv.y, 1.0, glow, 0.025);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -34,5 +38,6 @@ void main(void) {
|
||||||
else uv.y -= abs(time * 0.1);
|
else uv.y -= abs(time * 0.1);
|
||||||
|
|
||||||
vec4 color = vec4(255, 120, 153, 255) / 255.;
|
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;
|
||||||
}
|
}
|
|
@ -51,7 +51,7 @@ void Combat::draw(sf::RenderWindow *window) {
|
||||||
|
|
||||||
void Combat::updateEvents(sf::Event e) {
|
void Combat::updateEvents(sf::Event e) {
|
||||||
if (playerOneTurn) {
|
if (playerOneTurn) {
|
||||||
bool aux = player->event(e);
|
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())) {
|
||||||
|
@ -63,7 +63,7 @@ void Combat::updateEvents(sf::Event e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!ia) {
|
else if (!ia) {
|
||||||
bool aux = !enemy->event(e);
|
bool aux = !enemy->event(e, !attacking);
|
||||||
enemyManager(aux); //end of player two not ia ritm
|
enemyManager(aux); //end of player two not ia ritm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,10 @@ void Compas::add() {
|
||||||
void Compas::end() {
|
void Compas::end() {
|
||||||
if (isPress) {
|
if (isPress) {
|
||||||
isPress = false;
|
isPress = false;
|
||||||
std::cout << "end" << std::endl;
|
// std::cout << "end" << std::endl;
|
||||||
for (int i = 0; i < notes.size(); ++i) {
|
// for (int i = 0; i < notes.size(); ++i) {
|
||||||
std::cout << notes[i] << std::endl;
|
// std::cout << notes[i] << std::endl;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ bool Player::updateLogic(float deltaTime, sf::RenderWindow *window) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::event(sf::Event e) {
|
bool Player::event(sf::Event e, bool def) {
|
||||||
switch(e.type) {
|
switch(e.type) {
|
||||||
case (sf::Event::KeyPressed):
|
case (sf::Event::KeyPressed):
|
||||||
if(e.key.code == sf::Keyboard::C) {
|
if(e.key.code == sf::Keyboard::C) {
|
||||||
|
@ -35,9 +35,8 @@ bool Player::event(sf::Event e) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
compas.end();
|
compas.end();
|
||||||
error = true; //weird?
|
error = true;
|
||||||
if (animate != PlayerState::inMidle) animate = PlayerState::hurt;
|
if (animate != PlayerState::inMidle) animate = PlayerState::hurt;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Player : public Actor {
|
||||||
public:
|
public:
|
||||||
Player();
|
Player();
|
||||||
Player(int num);
|
Player(int num);
|
||||||
bool event(sf::Event e) final override;
|
bool event(sf::Event e, bool def) final override;
|
||||||
protected:
|
protected:
|
||||||
bool updateLogic(float deltaTime, sf::RenderWindow *window);
|
bool updateLogic(float deltaTime, sf::RenderWindow *window);
|
||||||
|
|
||||||
|
|
Reference in a new issue