From debd80e48580dc0be197e4780f47b384447af50f Mon Sep 17 00:00:00 2001 From: gambasconjamon Date: Mon, 20 May 2019 20:21:57 +0200 Subject: [PATCH] fix/ sound --- SpacePizza.depend | 44 +++++++++++++++++++++----------------------- include/Jugador.h | 4 +++- src/Jugador.cpp | 7 +++++++ src/Mundo.cpp | 15 ++++++++++----- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/SpacePizza.depend b/SpacePizza.depend index ac8cc02..abd96b2 100644 --- a/SpacePizza.depend +++ b/SpacePizza.depend @@ -268,7 +268,7 @@ "SFML/Audio.hpp" -1557855583 D +1557855587 D 1557853173 shed changes "SuperSprite.h" @@ -345,7 +345,7 @@ 1557855587 hics.hpp> -1558373438 source:/home/samuel/FV/SpacePizza/src/Mundo.cpp +1558375785 source:/home/samuel/FV/SpacePizza/src/Mundo.cpp "Mundo.h" "Juego.h" "Car.h" @@ -457,7 +457,7 @@ 1555240051 nyxml/tinyxml2.h" -1558373102 /home/samuel/FV/SpacePizza/include/Mundo.h +1558374562 /home/samuel/FV/SpacePizza/include/Mundo.h @@ -538,16 +538,16 @@ "Mundo.h" -1558369964 source:/home/samuel/FV/SpacePizza/src/Juego.cpp +1558374562 source:/home/samuel/FV/SpacePizza/src/Juego.cpp "Juego.h" "EJugando.h" "EMenu.h" -1558369965 source:/home/samuel/FV/SpacePizza/src/Jugador.cpp +1558375716 source:/home/samuel/FV/SpacePizza/src/Jugador.cpp "Jugador.h" "Puntuacion.h" -1557869035 /home/samuel/FV/SpacePizza/include/Jugador.h +1558375726 /home/samuel/FV/SpacePizza/include/Jugador.h @@ -775,7 +775,7 @@ "Item.h" -1558372247 source:/home/samuel/FV/SpacePizza/src/EFin.cpp +1558374562 source:/home/samuel/FV/SpacePizza/src/EFin.cpp "EFin.h" "Juego.h" "EMenu.h" @@ -786,22 +786,22 @@ -1558369964 /home/samuel/FV/SpacePizza/include/EFin.h +1558374562 /home/samuel/FV/SpacePizza/include/EFin.h "State.h" "SuperSprite.h" "ControladorSonido.h" "SFML/Graphics.hpp" -1558373876 source:/home/samuel/FV/SpacePizza/src/EJugando.cpp +1558374562 source:/home/samuel/FV/SpacePizza/src/EJugando.cpp "EJugando.h" -1558373086 /home/samuel/FV/SpacePizza/include/EJugando.h +1558374562 /home/samuel/FV/SpacePizza/include/EJugando.h "State.h" "Juego.h" "SFML/Graphics.hpp" "Puntuacion.h" -1558369964 source:/home/samuel/FV/SpacePizza/src/EMenu.cpp +1558374562 source:/home/samuel/FV/SpacePizza/src/EMenu.cpp "EMenu.h" "Juego.h" "EComo.h" @@ -1419,17 +1419,15 @@ "SFML/Audio.hpp" -<<<<<<< HEAD -1557855930 /home/samuel/FV/SpacePizza/include/ControladorSonido.h - -1557855930 o.hpp" -======= -1558369964 /home/samuel/FV/SpacePizza/include/ControladorSonido.h +1558374562 /home/samuel/FV/SpacePizza/include/ControladorSonido.h "SFML/Audio.hpp" ->>>>>>> EstadoFin -1558369964 source:/home/samuel/FV/SpacePizza/src/ControladorSonido.cpp +1557855930 o.hpp" + +1558369964 adoFin + +1558374562 source:/home/samuel/FV/SpacePizza/src/ControladorSonido.cpp "ControladorSonido.h" @@ -1830,7 +1828,7 @@ 1557844549 source:/home/claudia/Desktop/SpacePizza/src/Path.cpp "Path.h" -1558369964 source:/home/samuel/FV/SpacePizza/src/EComo.cpp +1558375420 source:/home/samuel/FV/SpacePizza/src/EComo.cpp "EComo.h" "Juego.h" "EMenu.h" @@ -1840,7 +1838,7 @@ -1558369964 /home/samuel/FV/SpacePizza/include/EComo.h +1558375420 /home/samuel/FV/SpacePizza/include/EComo.h @@ -1949,11 +1947,11 @@ 1558364384 source:/home/carlos/FV2.0/SpacePizza/src/Puntuacion.cpp "Puntuacion.h" -1558369965 /home/samuel/FV/SpacePizza/include/Puntuacion.h +1558374562 /home/samuel/FV/SpacePizza/include/Puntuacion.h -1558371036 source:/home/samuel/FV/SpacePizza/src/Puntuacion.cpp +1558374562 source:/home/samuel/FV/SpacePizza/src/Puntuacion.cpp "Puntuacion.h" diff --git a/include/Jugador.h b/include/Jugador.h index 4b0efc5..6f067db 100644 --- a/include/Jugador.h +++ b/include/Jugador.h @@ -23,7 +23,9 @@ class Jugador void updateVida(int change); int getVidas(); int checkEstado(); + bool checkGod(); void setEstado(int e); + void setGod(bool c); void setCesped(bool c); void restartEstado(); SuperSprite* getSprite(){ return jugador_sprite; }; @@ -41,7 +43,7 @@ class Jugador PhysicsState *pState; int vidas; int estado; - bool cesped; + bool cesped,god; sf::Clock timer_estado; double limite_estado; diff --git a/src/Jugador.cpp b/src/Jugador.cpp index c61bf67..fa835ec 100644 --- a/src/Jugador.cpp +++ b/src/Jugador.cpp @@ -292,6 +292,13 @@ void Jugador::setCesped(bool c) { cesped=c; } +void Jugador::setGod(bool c) +{ + god=c; +} +bool Jugador::checkGod(){ +return god; +} // Este metodo permite modifcar la vida => hay que pasarle el valor a modificar incluyendo el signo si queremos restar void Jugador::updateVida(int change) { diff --git a/src/Mundo.cpp b/src/Mundo.cpp index b8e3424..4433cd1 100644 --- a/src/Mundo.cpp +++ b/src/Mundo.cpp @@ -523,7 +523,7 @@ void Mundo::checkPuntoEntrega() void Mundo::procesarInteraccion(bool eRight, bool eLeft, bool eUp, bool eDown) { visionIA(); - if(p1->checkEstado()!=11){ + if(!p1->checkGod()){ atacaIA(); } colisionItems(); @@ -570,7 +570,7 @@ int Mundo::getTime() void Mundo::updateMundo(bool eRight, bool eLeft, bool eUp, bool eDown,bool godMode, sf::Time t) { sf::Vector2f bounce(0.0,0.0); - if(p1->checkEstado()!=11){ + if(!p1->checkGod()){ bounce=colisionesMapa(godMode); } EnemigoGenerator(); @@ -579,9 +579,9 @@ void Mundo::updateMundo(bool eRight, bool eLeft, bool eUp, bool eDown,bool godMo p1->updateJugador(eRight,eLeft,eUp,eDown,bounce,t); if(godMode) - p1->setEstado(11); + p1->setGod(true); else{ - p1->setEstado(0); + p1->setGod(false); } @@ -598,6 +598,7 @@ void Mundo::updateMundo(bool eRight, bool eLeft, bool eUp, bool eDown,bool godMo factorVolumen = ((float)500 - (float)distanciaEnemigo) / (float)500; e1[en]->setVolumen(factorVolumen * 210); + } /**coches**/ for(unsigned int i = 0; i setPosition(p1->getSprite()->getRenderPos().x-140,p1->getSprite()->getRenderPos().y - 90); ventana->draw(*text_player_lifes); - if(p1->checkEstado()==11){ + if(p1->checkGod()){ text_player_lifes -> setColor(Color::Green); }else{ text_player_lifes -> setColor(Color::Red); @@ -802,6 +803,10 @@ void Mundo::drawMundo(sf::RenderWindow * ventana, double inter) if(p1-> checkEstado() == 10) { + for(unsigned en=0; en< e1.size(); en++) + { + e1[en]->setVolumen(0.0); + } if( transfer.getElapsedTime().asSeconds()>0.8){ ControladorSonido::getInstance()->stopMusica(); vista = new View();