CODIGO DE MI JUEGO GUITAR HERO, el problema es que al presionar la tecla en el momento adecuado mi volumen que esta en 20 deberia subir a 100 pero no lo hace.. les detallo parte de mi codigo
Este codigo esta sobre un movie clip llamado LEFT....recuerda que son 3 botones mas right up down(primero iba a presionar las flechas pero cambie por las letras a.s.d.f.)
*************************************
Código :
onClipEvent (load) { function Tocado() { if (m_activa == true) { l_tocado = false; if (this.nombre == "left" && Key.isDown(65)) { l_tocado = true; } else if (this.nombre == "up" && Key.isDown(68)) { l_tocado = true; } else if (this.nombre == "down" && Key.isDown(83)) { l_tocado = true; } else if (this.nombre == "right" && Key.isDown(70)) { l_tocado = true; } // end else if if (this._y > _root.ygood - _root.timegreat / 2 && this._y < _root.ygood + _root.timegreat / 2) { if (l_tocado) { m_activa = false; ++_root.countexcellent; gotoAndPlay(2); return (1); } else { return (4); } // end else if } else if (this._y > _root.ygood - _root.timegood / 2 && this._y < _root.ygood + _root.timegood / 2) { if (l_tocado) { m_activa = false; ++_root.countgood; gotoAndPlay(2); return (2); } else { return (4); } // end else if } else if (this._y > _root.ygood - _root.timeregular / 2 && this._y < _root.ygood + _root.timeregular / 2) { if (l_tocado) { m_activa = false; ++_root.countregular; gotoAndPlay(2); return (3); } else { return (4); } // end else if } else if (this._y < _root.ygood + _root.timeregular / 2) { m_activa = false; ++_root.countbad; return (0); } // end else if } else { return (4); } // end else if } // End of the function m_activa = true; } onClipEvent (enterFrame) { if (this._name != "left") { this._y = this._y - _root.vel; } // end if if (_root.finalizado == 0) { if (this.identificador == _root.numflechas && this._y < -20) { _root.finalizado = 1; _root.puntus.play(); } // end if } // end if }
***************************************
Pero al entrar al movie clip LEFT, se ejecuta unos frames con animaciones y supuestamente setvolumne 100
Todo esta en el frame 30 del timeline
1.-Un MC donde creo el sonido "song1"
var cancion1:Sound=new Sound();
cancion1.attachSound("song1");
cancion1.start(0,1);
cancion1.setVolume(20);
2.-Los MC (tienen forma de boton) Left, Right, UP , Down que sobre cada uno esta un codigo como el de arriba mencionado
3.- Dentro de los MC Left, Right, UP , Down, existe unos 40 frames para dar un efecto de una animacion y ademas esta el codigo que deberia subir el volumen
cancion1.setVolume(100);
4.- El codigo que duplica los MC para dar el efecto de que suben los botones y al presionarlo dan puntaje y demas
Código :
_root.countexcellent = 0; _root.countgood = 0; _root.countregular = 0; _root.countbad = 0; _root.level = 1; _root. frame = 20; m_combo = 0; m_bien = 0; m_last = 0; m_score = 0; _root.finalizado = 0; var flechas = new Array(); flechas.push("500:1"); flechas.push("600:2"); flechas.push("700:1"); flechas.push("800:3"); flechas.push("900:2"); flechas.push("1000:2"); flechas.push("1100:5"); flechas.push("1200:4"); flechas.push("1300:4"); flechas.push("1300:1"); flechas.push("1500:3"); flechas.push("1600:2"); flechas.push("1700:1"); flechas.push("1800:3"); flechas.push("1900:4"); flechas.push("2000:4"); flechas.push("2100:4"); flechas.push("2200:2"); flechas.push("2300:2"); flechas.push("2400:2"); flechas.push("2500:1"); flechas.push("2600:2"); flechas.push("2700:3"); flechas.push("2800:4"); flechas.push("2900:4"); flechas.push("3000:1"); flechas.push("3100:2"); flechas.push("3200:3"); flechas.push("3300:4"); flechas.push("3400:4"); flechas.push("3500:4"); flechas.push("3600:1"); flechas.push("3700:2"); flechas.push("3800:3"); flechas.push("3900:4"); flechas.push("4000:4"); flechas.push("4100:3"); flechas.push("4200:2"); flechas.push("4300:1"); flechas.push("4400:1"); flechas.push("4500:3"); flechas.push("4600:1"); flechas.push("4700:4"); flechas.push("4800:2"); flechas.push("4900:3"); flechas.push("5000:3"); flechas.push("5100:3"); flechas.push("5200:2"); flechas.push("5300:2"); flechas.push("5400:1"); flechas.push("5500:2"); flechas.push("5600:3"); flechas.push("5700:4"); flechas.push("5800:4"); flechas.push("5900:4"); flechas.push("6000:1"); flechas.push("6100:1"); _root.numflechas = flechas.length; for (i = 1; i <= _root.numflechas; i++) { mapainfo = flechas[i - 1].split(":"); if (mapainfo[1] == "1") { left.duplicateMovieClip("flecha"+i,20+i); _root["flecha"+i]._x = 175; _root["flecha" + i].nombre = "left"; _root["flecha" + i].identificador = i; } else if (mapainfo[1] == "2") { down.duplicateMovieClip("flecha" + i, 20 + i); _root["flecha"+i]._x = 246; _root["flecha" + i].nombre = "down"; _root["flecha" + i].identificador = i; } else if (mapainfo[1] == "3") { up.duplicateMovieClip("flecha" + i, 20 + i); _root["flecha"+i]._x = 318; _root["flecha" + i].nombre = "up"; _root["flecha" + i].identificador = i; } else if (mapainfo[1] == "4") { right.duplicateMovieClip("flecha" + i, 20 + i); _root["flecha"+i]._x = 390; _root["flecha" + i].nombre = "right"; _root["flecha" + i].identificador = i; } // end else if _root["flecha"+i]._y = mapainfo[0]; } // end of for _root.onEnterFrame = function () { for (i = 1; i <= _root.numflechas; i++) { r = _root["flecha" + i].Tocado(); if (r == 1) { ++m_combo; m_bien = 1; m_last = 1; m_score = m_score + 3 * (m_combo + 1) * _root.multiplica; continue; } // end if if (r == 2) { ++m_combo; m_bien = 2; m_last = 2; m_score = m_score + 2 * (m_combo + 1) * _root.multiplica; continue; } // end if if (r == 3) { m_combo = 0; m_bien = 3; m_last = 3; m_score = m_score + 1 * _root.multiplica; continue; } // end if if (r == 0) { m_combo = 0; m_last = 0; continue; } // end if m_bien = 4; } // end of for mscore = "SCORE: " + m_score; mcombo = "X " + m_combo; if (m_last == 1) { textputnuacion = "EXCELENTE"; } else if (m_last == 2) { textputnuacion = "MUY BIEN"; } else if (m_last == 3) { textputnuacion = "REGULAR"; } else { textputnuacion = ""; } // end else if }; stop ();