added zip file

This commit is contained in:
Ralusama19 2017-01-22 15:41:03 +01:00
parent c762484669
commit e6ce69e20a
10 changed files with 25 additions and 25 deletions

BIN
Radio Wave.zip Normal file

Binary file not shown.

View file

@ -35,8 +35,8 @@ bool Actor::update(float deltaTime, sf::RenderWindow *window) {
bool Actor::hitBy(Compas enemy) { bool Actor::hitBy(Compas enemy) {
bool dodge = enemy == compas; bool dodge = enemy == compas;
if (dodge) std::cout << "dodge" << std::endl; /*if (dodge) //std::cout << "dodge" << std::endl;
else std::cout << "hit" << std::endl; else //std::cout << "hit" << std::endl;*/
if (!dodge) { if (!dodge) {
character->setState(PlayerState::hurt); character->setState(PlayerState::hurt);
animate = PlayerState::inMidle; animate = PlayerState::inMidle;

View file

@ -25,7 +25,7 @@ int Button::getClicks(){
int c = _clicks; int c = _clicks;
//cout << "popping clicks " << c << endl; //cout << "popping clicks " << c << endl;
_clicks = 0; _clicks = 0;
//if (_clicks > 0) std::cout << "popclicks = " << _clicks << std::endl; //if (_clicks > 0) //std::cout << "popclicks = " << _clicks << std::endl;
return c; return c;
} }
@ -51,14 +51,14 @@ void Button::handleMouseEvent(sf::Event& event){
switch (event.type){ switch (event.type){
case (sf::Event::MouseButtonPressed): case (sf::Event::MouseButtonPressed):
if(_state == ButtonState::active) _state = ButtonState::pressed; if(_state == ButtonState::active) _state = ButtonState::pressed;
//std::cout << "pressed!" << _clicks << std::endl; ////std::cout << "pressed!" << _clicks << std::endl;
break; break;
case (sf::Event::MouseButtonReleased): case (sf::Event::MouseButtonReleased):
if(_state == ButtonState::pressed){ if(_state == ButtonState::pressed){
_state = ButtonState::active; _state = ButtonState::active;
++_clicks; ++_clicks;
//std::cout << "released!" << _clicks << std::endl; ////std::cout << "released!" << _clicks << std::endl;
} }
break; break;

View file

@ -54,26 +54,26 @@ void Character::setState(PlayerState::playerState state){
SoundManager::setVolume(100,sample); SoundManager::setVolume(100,sample);
SoundManager::playSound(sample); SoundManager::playSound(sample);
//std::cout << "playing sample " << sample << std::endl; ////std::cout << "playing sample " << sample << std::endl;
} }
else if (state == PlayerState::hurt){ else if (state == PlayerState::hurt){
//std::cout << "i am hurt" << std::endl; ////std::cout << "i am hurt" << std::endl;
indexX = 0; indexX = 0;
indexY = 2 + magicNumber; indexY = 2 + magicNumber;
std::string sample = "fail"+std::to_string(rand()%6+1); std::string sample = "fail"+std::to_string(rand()%6+1);
SoundManager::setVolume(100,sample); SoundManager::setVolume(100,sample);
SoundManager::playSound(sample); SoundManager::playSound(sample);
//std::cout << "playing sample " << sample << std::endl; ////std::cout << "playing sample " << sample << std::endl;
} }
else if (state == PlayerState::success){ else if (state == PlayerState::success){
//std::cout << "i am succeed!" << std::endl; ////std::cout << "i am succeed!" << std::endl;
indexX = 0; indexX = 0;
indexY = 3 + magicNumber; indexY = 3 + magicNumber;
std::string sample = "bona"+std::to_string(rand()%8+1); std::string sample = "bona"+std::to_string(rand()%8+1);
SoundManager::setVolume(10,sample); SoundManager::setVolume(10,sample);
SoundManager::playSound(sample); SoundManager::playSound(sample);
std::cout << "playing sample " << sample << std::endl; //std::cout << "playing sample " << sample << std::endl;
} }
} }

View file

@ -210,7 +210,7 @@ void Combat::enemyManager(bool compasFinish) { //To do: considerar si hay ia
} }
void Combat::doMahWaves(bool p) { void Combat::doMahWaves(bool p) {
std::cout << "defensa jugador " << p << std::endl; //std::cout << "defensa jugador " << p << std::endl;
std::vector<int> notes; std::vector<int> notes;
if(p){ if(p){
notes = player->getAttack().getNotes(); notes = player->getAttack().getNotes();
@ -221,7 +221,7 @@ void Combat::doMahWaves(bool p) {
if(!p) anterior = 256+256*anterior; if(!p) anterior = 256+256*anterior;
else anterior = 768-256*anterior; else anterior = 768-256*anterior;
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;
Wave* w = new Wave(p); Wave* w = new Wave(p);
//if(!p) w->setPosition(anterior,500); //if(!p) w->setPosition(anterior,500);
//else w->setPosition(512-512*anterior,500); //else w->setPosition(512-512*anterior,500);
@ -237,7 +237,7 @@ void Combat::doMahWaves(bool p) {
// if(!p) anterior = 512+256*anterior; // if(!p) anterior = 512+256*anterior;
// else anterior = 512-256*anterior; // else anterior = 512-256*anterior;
// for(int i = 0; i < 20; ++i){ // for(int i = 0; i < 20; ++i){
// //std::cout << 0 << std::endl; // ////std::cout << 0 << std::endl;
// Wave* w = new Wave(p); // Wave* w = new Wave(p);
// //if(!p) w->setPosition(anterior,500); // //if(!p) w->setPosition(anterior,500);
// //else w->setPosition(512-512*anterior,500); // //else w->setPosition(512-512*anterior,500);

View file

@ -9,7 +9,7 @@ Compas::Compas() {
void Compas::start() { void Compas::start() {
failed = false; failed = false;
if (not isPress) { if (not isPress) {
// std::cout << "start" << std::endl; // //std::cout << "start" << std::endl;
isPress = true; isPress = true;
spaceTime = 1; spaceTime = 1;
notes = std::vector<int>(); notes = std::vector<int>();
@ -20,16 +20,16 @@ void Compas::add() {
if (isPress) { if (isPress) {
notes.push_back(spaceTime); notes.push_back(spaceTime);
spaceTime = 1; spaceTime = 1;
// std::cout << "add" << std::endl; // //std::cout << "add" << std::endl;
} }
} }
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;
// } // }
} }
} }

View file

@ -28,7 +28,7 @@ void Game::run() {
float time = c.getElapsedTime().asSeconds(); float time = c.getElapsedTime().asSeconds();
float deltaTime = time-oldTime; float deltaTime = time-oldTime;
oldTime = time; oldTime = time;
//std::cout << deltaTime << std::endl; ////std::cout << deltaTime << std::endl;
update(deltaTime, &window); update(deltaTime, &window);
draw( &window); draw( &window);
} }

View file

@ -17,7 +17,7 @@ Menu::Menu() {
void Menu::update(float deltaTime, sf::RenderWindow*window){ void Menu::update(float deltaTime, sf::RenderWindow*window){
//float dx = InputManager::action(InputAction::moveX0); //float dx = InputManager::action(InputAction::moveX0);
//_buttons[0]->move(dx,0); //_buttons[0]->move(dx,0);
//std::cout << dx << std::endl; ////std::cout << dx << std::endl;
for(unsigned int i = 0; i < _buttons.size(); ++i){ for(unsigned int i = 0; i < _buttons.size(); ++i){
_buttons[i]->update(window->mapPixelToCoords(sf::Vector2i(sf::Mouse::getPosition(*window)))); _buttons[i]->update(window->mapPixelToCoords(sf::Vector2i(sf::Mouse::getPosition(*window))));
} }
@ -31,14 +31,14 @@ void Menu::draw(sf::RenderWindow* window){
} }
void Menu::updateEvents(sf::Event e){ void Menu::updateEvents(sf::Event e){
// std::cout << "update menu buttons" << std::endl; // //std::cout << "update menu buttons" << std::endl;
for(unsigned int i = 0; i < _buttons.size(); ++i){ for(unsigned int i = 0; i < _buttons.size(); ++i){
_buttons[i]->handleMouseEvent(e); _buttons[i]->handleMouseEvent(e);
} }
MyGame* g = static_cast<MyGame*>(Game::i()); MyGame* g = static_cast<MyGame*>(Game::i());
if (_start.getClicks() > 0){ if (_start.getClicks() > 0){
g->changeScene(GameScene::inGame); g->changeScene(GameScene::inGame);
std::cout << "Game not ready to be played. Please Wait." << std::endl; //std::cout << "Game not ready to be played. Please Wait." << std::endl;
} }
else if(_exit.getClicks() > 0) g->isRunning = false; else if(_exit.getClicks() > 0) g->isRunning = false;

View file

@ -8,7 +8,7 @@ MyGame::MyGame() {
_scenes[GameScene::inGame] = _combat; _scenes[GameScene::inGame] = _combat;
_scenes[GameScene::help] = _menu; _scenes[GameScene::help] = _menu;
_scenes[GameScene::credits] = _menu; _scenes[GameScene::credits] = _menu;
std::cout << "in menu" << std::endl; //std::cout << "in menu" << std::endl;
SoundManager::load(); SoundManager::load();
SoundManager::setLoop(true, "intro"); SoundManager::setLoop(true, "intro");
SoundManager::playMusic("intro"); SoundManager::playMusic("intro");
@ -38,7 +38,7 @@ void MyGame::changeScene(GameScene::gameScene n){
// Main game loop // Main game loop
void MyGame::update(float deltaTime, sf::RenderWindow*window) { void MyGame::update(float deltaTime, sf::RenderWindow*window) {
// std::cout << deltaTime << std::endl; // //std::cout << deltaTime << std::endl;
sf::Event event; sf::Event event;
while(window->pollEvent(event)){ while(window->pollEvent(event)){
switch (event.type) { switch (event.type) {
@ -56,7 +56,7 @@ void MyGame::update(float deltaTime, sf::RenderWindow*window) {
switch(_scene){ switch(_scene){
case(GameScene::menu): case(GameScene::menu):
//std::cout << "still in menu" << std::endl; ////std::cout << "still in menu" << std::endl;
break; break;
default: default:
break; break;

View file

@ -35,7 +35,7 @@ bool Player::event(sf::Event e) {
std::string sample = "mod"+std::to_string(rand()%2+1); std::string sample = "mod"+std::to_string(rand()%2+1);
if(!mod) sample = "note"+std::to_string(rand()%4+1); if(!mod) sample = "note"+std::to_string(rand()%4+1);
SoundManager::playSound(sample); SoundManager::playSound(sample);
std::cout << "playing sample " << sample << std::endl; //std::cout << "playing sample " << sample << std::endl;
compas.start(); compas.start();
error = false; error = false;
} }