Thanks for your answer eXpl0it3r,
I'd just like one sound to be played when the ship moves (every positions).
Here is a method I wrote for the Ship class :
void Ship::move_sound(sf::Sound *sound)
{
if(isSoundPlaying == false)
{
sound->play();
isSoundPlaying = true;
}
else
{
sound->stop();
isSoundPlaying = false;
}
}
isSoundPlaying is a boolean that is initialized to false when the Ship object is created. Then I put :
player->move_sound();
inside each if statements but it doesn't give me the loop effect I'd like to have.
I'd like that the ship sound (1 second) would repeat each time it reaches the end of its loop and that either Up, Down, Left or Right is pressed (at least).