I am trying to make a flying saucer’s take off sound effect. While the flying saucer is “ascending” upwards I have a sound cue I’d like to play. If the flying saucer stops in mid ascension I want the flying SFX to play. If the Flying Saucer decided to start ascending again, I want the Ascend SFX to pick up where it left off.
Essentially this is what I’m thinking. But I’m not sure how to play a SoundCue at a specific timeframe. (e.g. I’ve been ascneding for 2 seconds. I have 3 more seconds left in my ascention. I then want to play my ascneding Sound Cue at (2/3 * LengthOfAscendTimeSound)
Pseudo Code of what I’m thinking.
while(ascending)
{
StopSounds();
// TODO: play ascending sound at specific time-frame.
Play(AscendingSound);
}
while(Flying)
{
StopSounds();
Play(FlySound);
}
Any direction to documentation or similar design pattern to make something like this work would be appreciated!
In C++ btw. Thank you!