magic sync for waves, not in center tho
This commit is contained in:
parent
a1d2df2034
commit
e2e36835a7
7 changed files with 40 additions and 22 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -127,20 +127,36 @@ void Combat::doMahWaves(bool p){
|
|||
notes = player->getAttack().getNotes();
|
||||
}
|
||||
else notes = enemy->getAttack().getNotes();
|
||||
|
||||
if (notes.size() > 0){
|
||||
int anterior = notes[0];
|
||||
if(!p) anterior = 512+512*anterior;
|
||||
else anterior = 512-512*anterior;
|
||||
if(!p) anterior = 512+256*anterior;
|
||||
else anterior = 512-256*anterior;
|
||||
for(int i = 0; i < notes.size(); ++i){
|
||||
std::cout << notes[i] << std::endl;
|
||||
Wave* w = new Wave(p);
|
||||
//if(!p) w->setPosition(anterior,500);
|
||||
//else w->setPosition(512-512*anterior,500);
|
||||
w->setPosition(anterior,500);
|
||||
w->setPosition(anterior,200);
|
||||
if(i<notes.size()) {
|
||||
if(!p) anterior += 256*notes[i+1];
|
||||
else anterior -= 256*notes[i+1];
|
||||
if(!p) anterior += 176*notes[i+1];
|
||||
else anterior -= 176*notes[i+1];
|
||||
}
|
||||
waves.push_back(w);
|
||||
}
|
||||
|
||||
// int anterior = 1;
|
||||
// if(!p) anterior = 512+256*anterior;
|
||||
// else anterior = 512-256*anterior;
|
||||
// for(int i = 0; i < 20; ++i){
|
||||
// //std::cout << 0 << std::endl;
|
||||
// Wave* w = new Wave(p);
|
||||
// //if(!p) w->setPosition(anterior,500);
|
||||
// //else w->setPosition(512-512*anterior,500);
|
||||
// w->setPosition(anterior,200);
|
||||
// if(i<20) {
|
||||
// if(!p) anterior += 128*4;
|
||||
// else anterior -= 128*4;
|
||||
// }
|
||||
// waves.push_back(w);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ MyGame::MyGame() {
|
|||
_scenes[GameScene::credits] = _menu;
|
||||
std::cout << "in menu" << std::endl;
|
||||
SoundManager::load();
|
||||
SoundManager::setGlobalSoundVolumen(50);
|
||||
SoundManager::setLoop(true, "intro");
|
||||
SoundManager::playMusic("intro");
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ Wave::Wave(bool dir){
|
|||
direction = dir;
|
||||
ASSERT(texture.loadFromFile(spriteFile));
|
||||
setTexture(texture);
|
||||
setOrigin(texture.getSize().x/2,0);
|
||||
// sf::IntRect rect = sf::IntRect(0, 0, texture.getSize().x, texture.getSize().y);
|
||||
// setTextureRect(rect);
|
||||
}
|
||||
|
@ -18,10 +19,10 @@ Wave::Wave(bool dir){
|
|||
void Wave::update(float deltaTime){
|
||||
float pos = getPosition().x;
|
||||
if (direction){
|
||||
pos += 1280*deltaTime; // AMOUNT??
|
||||
pos += 640*deltaTime; // AMOUNT??
|
||||
}
|
||||
else{
|
||||
pos -= 1280*deltaTime; // ""
|
||||
pos -= 640*deltaTime; // ""
|
||||
}
|
||||
setPosition(pos, getPosition().y);
|
||||
}
|
||||
|
|
Reference in a new issue