Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 发现差异游戏-如何创建获胜屏幕(单击计数器进入下一阶段)_Actionscript 3_Flash_Actionscript - Fatal编程技术网

Actionscript 3 发现差异游戏-如何创建获胜屏幕(单击计数器进入下一阶段)

Actionscript 3 发现差异游戏-如何创建获胜屏幕(单击计数器进入下一阶段),actionscript-3,flash,actionscript,Actionscript 3,Flash,Actionscript,我正在为不同的游戏创建一个简单的点(只有一个关卡)。单击不同的点时,将出现一个旋转圆并高亮显示该点。 我开发了上面的功能,以及定时器倒计时 但是,当我尝试开发一个功能时,在找到所有点后,它将移动到下一帧“3”,显示“you win”,并开发生命倒计时(如果单击上面5点之外的点,生命将减少到0),它不起作用。 你能帮我检查一下我的代码有什么问题吗 另外,我想问一下,是否有其他方法可以实现上述的中奖屏幕(点击所有点后,它将自动指向中奖屏幕)和生命计数器。(如果单击5个不同点之外的点,您将失去一条生命

我正在为不同的游戏创建一个简单的点(只有一个关卡)。单击不同的点时,将出现一个旋转圆并高亮显示该点。 我开发了上面的功能,以及定时器倒计时

但是,当我尝试开发一个功能时,在找到所有点后,它将移动到下一帧“3”,显示“you win”,并开发生命倒计时(如果单击上面5点之外的点,生命将减少到0),它不起作用。 你能帮我检查一下我的代码有什么问题吗


另外,我想问一下,是否有其他方法可以实现上述的中奖屏幕(点击所有点后,它将自动指向中奖屏幕)和生命计数器。(如果单击5个不同点之外的点,您将失去一条生命)

这是我游戏的打印屏幕

右侧的圆圈是mv_check_d1,左侧的圆圈是mv_check_d6

正如你所看到的,在我点击了所有的点后,它并没有指向赢家屏幕,计时器倒计时仍然在运行

这是我的密码:

注意:btn\u click\u d1是我的按钮,放在不同的位置。单击该点时,符号mv_check_d1(红色圆圈)将围绕该点旋转

gotoAndStop(2)指向帧上方的游戏

gotoAndStop(3)指向获奖/祝贺框

 stop();

import flash.events.MouseEvent;

//Create event for the button when being clicked/touched on
btn_click_d1.addEventListener(MouseEvent.CLICK, click_d1);
    function click_d1 (event:MouseEvent):void{
        mv_check_d1.gotoAndPlay(1);

        //After operating event, remove the button
        btn_click_d1.removeEventListener(MouseEvent.CLICK, click_d1);

        //After clicking, also remove the button so that the user will not click it twice

        }
        btn_click_d1.useHandCursor = false;

//when click button 1, the checkpoint will also appear on the left screen
btn_click_d1.addEventListener(MouseEvent.CLICK, click_d6);
    function click_d6 (event:MouseEvent):void{
        mv_check_d6.gotoAndPlay(1);

        //After operating event, remove the button
        btn_click_d1.removeEventListener(MouseEvent.CLICK, click_d6);

        //After clicking, also remove the button so that the user will not click it twice

        }
        btn_click_d1.useHandCursor = false; 

btn_click_d2.addEventListener(MouseEvent.CLICK, click_d2);
    function click_d2 (event:MouseEvent):void{
        mv_check_d2.gotoAndPlay(1);

        //After operating event, remove the button
        btn_click_d2.removeEventListener(MouseEvent.CLICK, click_d1);

        //After clicking, also remove the button so that the user will not click it twice

        }
        btn_click_d2.useHandCursor = false;

btn_click_d3.addEventListener(MouseEvent.CLICK, click_d3);
    function click_d3 (event:MouseEvent):void{
        mv_check_d3.gotoAndPlay(1);

        //After operating event, remove the button
        btn_click_d3.removeEventListener(MouseEvent.CLICK, click_d3);

        //After clicking, also remove the button so that the user will not click it twice

        }
        btn_click_d3.useHandCursor = false;

btn_click_d4.addEventListener(MouseEvent.CLICK, click_d4);
    function click_d4 (event:MouseEvent):void{
        mv_check_d4.gotoAndPlay(1);

        //After operating event, remove the button
        btn_click_d4.removeEventListener(MouseEvent.CLICK, click_d4);

        //After clicking, also remove the button so that the user will not click it twice

        }
        btn_click_d4.useHandCursor = false;

btn_click_d5.addEventListener(MouseEvent.CLICK, click_d5);
    function click_d5 (event:MouseEvent):void{
        mv_check_d5.gotoAndPlay(1);

        //After operating event, remove the button
        btn_click_d5.removeEventListener(MouseEvent.CLICK, click_d5);

        //After clicking, also remove the button so that the user will not click it twice

        }
        btn_click_d5.useHandCursor = false;

//1.
var count:Number = 30;

//2.
var myTimer:Timer = new Timer(1000,count);

//3.
myTimer.addEventListener(TimerEvent.TIMER, countdown);
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete); 
//4.
myTimer.start();

//5.
function countdown(event:TimerEvent):void {
myText_txt.text = String((count)-myTimer.currentCount);
}

function onTimerComplete(e:TimerEvent):void{
myTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);

gotoAndStop(2);
}

//nextlevel and life countdown

var NextLevelCounter:int = 0; 
var LivesCounter:int = 3;
function clickListener(e:MouseEvent):void {
   if(btn_click_d1.hitTestPoint(e.localX, e.localY) || btn_click_d2.hitTestPoint(e.localX, e.localY) || btn_click_d3.hitTestPoint(e.localX, e.localY) || btn_click_d4.hitTestPoint(e.localX, e.localY) || btn_click_d5.hitTestPoint(e.localX, e.localY)){

      ++NextLevelCounter;
   }
   else{
      --LivesCounter;
   }

   if(NextLevelCounter == 5)
      goToNextLevel();
   if(LivesCounter == 0)
      lose();
}

 function goToNextLevel():void{ 
    gotoAndStop(3);
 }
  function lose():void{
     gotoAndStop(2); 
  }

伟大的你的问题是什么?我想问一下我的代码是否有什么问题,因为计数器单击和更改到Win屏幕的代码无法工作。在我点击所有不同的点(用于测试)之后,什么都没有发生。它没有移动到下一帧(win屏幕)。是否应该在1播放
mv_check_d6
mv_check_d1
?是的,我只是尝试了一下,因此如果我单击右侧图片上的点,圆圈将围绕该点旋转(在右侧和左侧图片上)我附上了输出闪光灯的打印屏幕供您查看。右侧的圆圈为mv_check_d1,左侧的圆圈为mv_check_d6。正如您在printscreen中看到的,计时器计数器工作,但是我提到的单击计数器不工作。[链接]在点击所有5个不同的点后,我还附加了打印屏幕。如您所见,在我点击5个点后,它不会重定向到下一帧(Win屏幕),并且倒计时仍在运行。