Copy link to clipboard
Copied
Hello!
I have googled the question but I didn't get any answare that helped.
Alright so I'm creating a car game, I have a soundclip in my library called "engine"
And I want it to play all the time except when I press the up button. When I press the up button I want my other sound "engine_2" to play when the key is pressed down and when released "engine" should start again.
Both sounds should loop all the time when played.
I'm a beginner with AS2 so be easy ![]()
Thank you.
Copy link to clipboard
Copied
//outside your loop (that you must have), use:
var s:Sound=new Sound(this);
var engineBool:Boolean;
var engine2Bool:Boolean;
// and inside your loop, use:
if (Key.isDown(Key.UP) && !engine2Bool) {
s.attachSound("engine_2ID"); // assign engine_2 a linkage id of engine_2ID;
s.start(0,999);
engine2Bool=true;
engineBool=false;
} else if(!engineBool){
s.attachSound("engineID"); // assign engine a linkage id of engineID
s.start(0,999);
engineBool=true;
engine2Bool=false;
}
Copy link to clipboard
Copied
Sorry I don't understand what you mean with inside and outside the loop ![]()
Copy link to clipboard
Copied
can you control your car? if yes, what code are you using to control your car?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more