added sound buffers
This commit is contained in:
parent
66377e60ee
commit
cc0d1e80eb
5 changed files with 12 additions and 7 deletions
|
@ -53,6 +53,9 @@ void Character::setState(PlayerState::playerState state){
|
||||||
idleFrame = indexX;
|
idleFrame = indexX;
|
||||||
indexX = 0;
|
indexX = 0;
|
||||||
indexY = 1 + magicNumber;
|
indexY = 1 + magicNumber;
|
||||||
|
std::string sample = "atk"+std::to_string(rand()%20+1);
|
||||||
|
SoundManager::playSound(sample);
|
||||||
|
std::cout << "playing sample " << sample << std::endl;
|
||||||
}
|
}
|
||||||
else if (false /*state == PlayerState::damaged*/){
|
else if (false /*state == PlayerState::damaged*/){
|
||||||
indexX = 0;
|
indexX = 0;
|
||||||
|
|
|
@ -8,7 +8,6 @@ Combat::Combat() {
|
||||||
// enemy = new IaEnemy(1);
|
// enemy = new IaEnemy(1);
|
||||||
enemy = new Player(1);
|
enemy = new Player(1);
|
||||||
initShader();
|
initShader();
|
||||||
SoundManager::load();
|
|
||||||
SoundManager::playMusic("music");
|
SoundManager::playMusic("music");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h> /* getenv */
|
#include <stdlib.h> /* getenv */
|
||||||
|
#include <stdlib.h> /* srand, rand */
|
||||||
|
#include <time.h> /* time */
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "soundmanager.hpp"
|
||||||
const int SCENE_NUM = 4;
|
const int SCENE_NUM = 4;
|
||||||
|
|
||||||
#define MARGEERR 0.05f
|
#define MARGEERR 0.05f
|
||||||
#define BLACKVALUE 0.60f
|
#define BLACKVALUE 0.60f
|
||||||
#define W_WIDTH 800
|
#define W_WIDTH 800
|
||||||
|
@ -27,21 +28,21 @@ const std::string WORK_DIR(getenv("WORK_DIR"));
|
||||||
assert(expression); \
|
assert(expression); \
|
||||||
std::exit(-1); \
|
std::exit(-1); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
namespace ButtonState {
|
namespace ButtonState {
|
||||||
//namespace for button states (for the menu)
|
//namespace for button states (for the menu)
|
||||||
//released is the regular state of the button, it activates when you move the mouse over it
|
//released is the regular state of the button, it activates when you move the mouse over it
|
||||||
//off means it is drawn but not clickable.
|
//off means it is drawn but not clickable.
|
||||||
enum basicState {released, active, pressed, off};
|
enum basicState {released, active, pressed, off};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace GameScene {
|
namespace GameScene {
|
||||||
enum gameScene{menu,inGame,help,credits};
|
enum gameScene{menu,inGame,help,credits};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PlayerState {
|
namespace PlayerState {
|
||||||
enum playerState{idle, attacking, inMidle};
|
enum playerState{idle, attacking, inMidle};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // COMMONS_HPP
|
#endif // COMMONS_HPP
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "mygame.hpp"
|
#include "mygame.hpp"
|
||||||
#include "compas.hpp"
|
#include "compas.hpp"
|
||||||
int main() {
|
int main() {
|
||||||
|
srand (time(NULL));
|
||||||
MyGame game;
|
MyGame game;
|
||||||
game.run();
|
game.run();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -9,6 +9,7 @@ MyGame::MyGame() {
|
||||||
_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();
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGame::~MyGame() {
|
MyGame::~MyGame() {
|
||||||
|
|
Reference in a new issue