Музикална игра на -ActionScript 2.0 - Помощ |
||||
|
||||
|
|
||||
![]() ![]() |
Здражеите! Ж момента разработжам музикална игра, кудето играчите триабжа да познаиат песента, коиато чужат. Разработих си интерфаце-а, бутоните и т.н, но не мога да сжурза музиката с отделните жупроси (жсеки жупрос има отделно музикално кличе) Използжам ЬМЛ, за да жужеда жупросите, но не мога да жужеда музиката. Опитах с мп3 плаъер, но тои проигража песните ж една дулга поредитса. Моиата тсел е с дажането на жерниа отгожор да се премине на следжащата песен. Молиа помогнете!! До тук сум стигнала сус сцриптирането: LOADER ----------------------- stop(); // get the questions loadQuestions = new LoadVars(); loadQuestions.load("flashtrivia.xml"); loadQuestions.onLoad = initQuestions; function initQuestions() { // break into questions using returns // NOTE: character 13 may work better in some cases than character 10 qArray = loadQuestions.questions.split(String.fro mCharCode(10)); // break each question into question and answers for(i=0;i<qArray.length;i++) { qArray[i] = qArray[i].split(":"); // break the answers apart qArray[i][1] = qArray[i][1].split(";"); } // start the game _root.gotoAndPlay("start game"); } Main Interactive Section -------------------------------------- initGame(); stop(); function initGame() { // set variables questionNum = 0; score = 0; // ask the first question displayQuestion(); } function displayQuestion() { // see whether all the questions have been asked if (questionNum >= qArray.length) { // show final score and end the game gotoAndPlay("game over"); } else { // rearrange answers = shuffleArray(qArray[questionNum][1].slic e(0)); // place the question and answers on the screen question.text = qArray[questionNum][0]; answer0.text = answers[0]; answer1.text = answers[1]; answer2.text = answers[2]; answer3.text = answers[3]; // show the question number questionNumDisplay = questionNum+1; // remember which one is correct correctAnswer = qArray[questionNum][1][0]; // make the text slide in animateIn(); // start potential points at 1000 potentialPoints = 1000; } } // every frame that goes by subtracts one point function scoreCount() { // make sure that last answer has arrived if (answer3._x == 400) { // subtract point potentialPoints -= 1; if (potentialPoints < 0) potentialPoints = 0; } } // take array1 and shuffle into array 2 function shuffleArray(array1) { // create new, empty array array2 = new Array(); // loop through array do { // select a random item r = int(Math.random()*array1.length); // add item to new array array2.push(array1[r]); // remove item from old array array1.splice(r,1); } while (array1.length > 0); // send back the new array return(array2); } function animateIn() { // set the location of each answer // and set where each should stop answer0.xstop = 400; answer0._x = 800; answer1.xstop = 400; answer1._x = 1000; answer2.xstop = 400; answer2._x = 1200; answer3.xstop = 400; answer3._x = 1400; } function selectAnswer(n) { // correct if (answers[n] == correctAnswer) { triggerSound("right"); // add score score += potentialPoints; // ask next question questionNum++; displayQuestion(); } else { // wrong triggerSound("wrong"); // subtract from potential points potentialPoints -= 200; if (potentialPoints < 0) potentialPoints = 0; // remove the answer _root["answer"+n].text = ""; } } #include "mp3player.as" Westony: ТУК СЕ ПИШЕ САМО И ЕДИНСТВЕНО НА КИРИЛИЦА !!!!!!!!!!!! |
|||
|
---------------------------
Потребител от: 23.08.08 | Всички уроци от rachko_2000 | Всички скриптове от rachko_2000 |
||||
|
|
||||
|
||||
| 1 посетител чете тази тема (0 потребители и 1 гост) | |||
|
Активни потребители:
---
|
|||
| |||
Още по темата:
php форум,
flash форум,
html форум,
it форум,
seo форум,
vista форум,
pc форум,
css форум,
java форум,
mysql форум,
дизайн форум







