Flash AS3琐事游戏错误答案图形需要出现在3个位置的舞台上

时间:2014-01-15 20:08:13

标签: actionscript-3 flash scoring

我正在创建一个琐事游戏,其中用户每回答一定数量的问题,如果他们得到3个错误,他们就会失败。当问题被标记为不正确时,x从左到右放置在一个框中,每个x都会进入他们自己位置的框中。

根据错误回答的问题,我无法将x转到他们的位置。

以下是游戏image

的图片

以下是我正在使用的代码:

var questions:Array=['"I look like a dangling parsnip in this!" she cried. "I will never __________ these jeans!',
                 "Tell the freckled parrot to put his car in __________.",
                 "When purchasing a buttercream trowel, always choose one made of __________.",
                 "Everybody has a cracked snowflake. The question is, __________ one is yours? ",
                 "Standing at the dock, the loopy basket watched the cruise ship set __________ without him. ",];
var answers:Array=[   ["wear","where"], ["idle","idol"], ["steel","steal"] ,[ "which","witch"] ,[ "sail","sale"] ];

var qno=0;var rnd1; var rnd2;
tick.visible=false;cross1.visible=false;
var right_answers=0;var wrong_answers=0;

shade1.buttonMode = true;
shade1.useHandCursor = true;

shade2.buttonMode = true;
shade2.useHandCursor = true;


function change_question(){
if(tick.visible){right_answers++;}
if(cross1.visible){wrong_answers++;}
if(qno==questions.length){gotoAndPlay(60);}else{
tick.visible=false;cross1.visible=false;
rnd1=Math.ceil(Math.random()*3);
rnd2=Math.ceil(Math.random()*questions.length)-1;
q.text=questions[rnd2];
if(questions[rnd2]=="x"){change_question();}
questions[rnd2]="x";
enable_disable(1);
if(rnd1==1){opt1.text=answers[rnd2][0];opt2.text=answers[rnd2][1];}
if(rnd1==2){opt1.text=answers[rnd2][0];opt2.text=answers[rnd2][1];}
if(rnd1==3){opt1.text=answers[rnd2][0];opt2.text=answers[rnd2][1];}
if(rnd1==4){opt1.text=answers[rnd2][0];opt2.text=answers[rnd2][1];}
if(rnd1==5){opt1.text=answers[rnd2][0];opt2.text=answers[rnd2][1];}
}}

function enable_disable(a){
if(a==0){shade1.mouseEnabled=false;shade2.mouseEnabled=false;}
if(a==1){shade1.mouseEnabled=true;shade2.mouseEnabled=true;}}

change_question();


shade1.addEventListener(MouseEvent.CLICK, ButtonAction2);
shade2.addEventListener(MouseEvent.CLICK, ButtonAction3);


function ButtonAction2(eventObject:MouseEvent) {
enable_disable(0);if(rnd1==1) {tick.visible=true;tick.y=shade1.y}else{cross1.visible=true;cross1.y=shade1.y}
//qno++;change_question();
}
function ButtonAction3(eventObject:MouseEvent) {
enable_disable(0);if(rnd1==2){tick.visible=true;tick.y=shade2.y}else{cross1.visible=true;cross1.y=428.55}
//qno++;change_question();
}

非常感谢任何帮助,如果需要更多信息,请告诉我。提前谢谢。

0 个答案:

没有答案