Xionraseri
03-01-2008, 12:09 AM
Does anyone know why my sound will not work? Any help greatly appreciated, last step and then game is done.
//from init function
//set up sounds
sndCrash = new Sound();
sndCrash.attachSound("crash.wav");
sndFlame = new Sound();
sndFlame.attachSound("flame.wav");
sndAlarm = new Sound();
sndAlarm.attachSound("alarm.wav");
//from checkKeys function
if (Key.isDown(Key.SPACE)){
//shoot flame
sndFlame.start();
flame._x = monster._x;
flame._y = monster._y;
flame.dir = monster.dir;
flame.speed = monster.speed + 20;
turn(flame);
}//end if
function checkCollisions(){
//check for collisions
if (monster.hitTest(car1)){
trace("hit by car 1!");
sndCrash.start();
reset(car1);
monster.lives --;
if (monster.lives <= 0){
_root.gotoAndStop("gameOver");
}//end if
} //end if
if (monster.hitTest(car2)){
trace("hit by car 2!");
sndCrash.start();
reset(car2);
monster.lives --;
if (monster.lives <= 0){
_root.gotoAndStop("gameOver");
}//end if
}//end if
if (monster.hitTest(car3)){
trace("hit by car 3!");
sndCrash.start();
reset(car3);
monster.lives --;
if (monster.lives <= 0){
_root.gotoAndStop("gameOver");
}//end if
}//end if
// look for flame collision
if (flame.hitTest(car1)){
trace("burned car 1");
sndAlarm.start();
resetFlame();
reset(car1);
monster.points += 100;
}//end if
if (flame.hitTest(car2)){
trace("burned car 2");
sndAlarm.start();
resetFlame();
reset(car2);
monster.points += 100;
}//end if
if (flame.hitTest(car3)){
trace("burned car 3");
sndAlarm.start();
resetFlame();
reset(car3);
monster.points += 100;
}//end if
}//end checkCollisions
//from init function
//set up sounds
sndCrash = new Sound();
sndCrash.attachSound("crash.wav");
sndFlame = new Sound();
sndFlame.attachSound("flame.wav");
sndAlarm = new Sound();
sndAlarm.attachSound("alarm.wav");
//from checkKeys function
if (Key.isDown(Key.SPACE)){
//shoot flame
sndFlame.start();
flame._x = monster._x;
flame._y = monster._y;
flame.dir = monster.dir;
flame.speed = monster.speed + 20;
turn(flame);
}//end if
function checkCollisions(){
//check for collisions
if (monster.hitTest(car1)){
trace("hit by car 1!");
sndCrash.start();
reset(car1);
monster.lives --;
if (monster.lives <= 0){
_root.gotoAndStop("gameOver");
}//end if
} //end if
if (monster.hitTest(car2)){
trace("hit by car 2!");
sndCrash.start();
reset(car2);
monster.lives --;
if (monster.lives <= 0){
_root.gotoAndStop("gameOver");
}//end if
}//end if
if (monster.hitTest(car3)){
trace("hit by car 3!");
sndCrash.start();
reset(car3);
monster.lives --;
if (monster.lives <= 0){
_root.gotoAndStop("gameOver");
}//end if
}//end if
// look for flame collision
if (flame.hitTest(car1)){
trace("burned car 1");
sndAlarm.start();
resetFlame();
reset(car1);
monster.points += 100;
}//end if
if (flame.hitTest(car2)){
trace("burned car 2");
sndAlarm.start();
resetFlame();
reset(car2);
monster.points += 100;
}//end if
if (flame.hitTest(car3)){
trace("burned car 3");
sndAlarm.start();
resetFlame();
reset(car3);
monster.points += 100;
}//end if
}//end checkCollisions