万卷书   首页 > 电脑书籍 > Flash > Flash MX实战精选:石头剪子布
 
  步骤16:鼠标右击“bu石头”,在Action面板输入如下语句:

  注:Random(3)的意思为由电脑自行从0,1,2三个数中产生一个随机数。

  步骤17:鼠标右击“bu剪子”,在Action面板输入如下语句:

on (press) {

/:totalplay = /:totalplay+1;

if (/:totalplay == 30) {

gotoAndStop (5);

} else {

/:a = random(3)+2;

if (/:a == 2) {

/:com = /:com+1;

}

if (/:a == 4) {

/:pla = /:pla+1;

}

tellTarget ("computer") {

gotoAndStop (/:a);

}

tellTarget ("person") {

gotoAndStop (3);

}

}

}

  步骤18:鼠标右击“bu布”,在Action面板输入如下语句:

on (press) {

/:totalplay = /:totalplay+1;

if (/:totalplay == 30) {

gotoAndStop (5);

} else {

/:a = random(3)+2;

if (/:a == 3) {

/:com = /:com+1;

}

if (/:a == 2) {

/:pla = /:pla+1;

}

tellTarget ("computer") {

gotoAndStop (/:a);

}

tellTarget ("person") {

gotoAndStop (4);

}

}

}

上一页 下一页