Android 如何检查是否在框架的开口处添加符号,并在添加时停止?
我的flash游戏快玩完了,鸭子从屏幕顶部掉下来,被抓在篮子里。我的这段代码基本上检查当它们达到某个Y值时是否在篮中,如果是,则将它们循环回屏幕顶部。如果不是,则将布尔值isOver设置为true。我正在尝试添加一个gameOver菜单在这个时候,通过检查在一帧的末尾是否isOver已设置为真。我的问题是,这是一个单帧函数,所以它不断循环愚蠢的菜单。添加菜单的无限实例 这是我的onEnterFrame函数代码Android 如何检查是否在框架的开口处添加符号,并在添加时停止?,android,actionscript-3,flash,Android,Actionscript 3,Flash,我的flash游戏快玩完了,鸭子从屏幕顶部掉下来,被抓在篮子里。我的这段代码基本上检查当它们达到某个Y值时是否在篮中,如果是,则将它们循环回屏幕顶部。如果不是,则将布尔值isOver设置为true。我正在尝试添加一个gameOver菜单在这个时候,通过检查在一帧的末尾是否isOver已设置为真。我的问题是,这是一个单帧函数,所以它不断循环愚蠢的菜单。添加菜单的无限实例 这是我的onEnterFrame函数代码 感谢您的帮助 解决此问题的简单方法是使您的flash游戏有2帧: 在第一帧中,您在on
感谢您的帮助 解决此问题的简单方法是使您的flash游戏有2帧: 在第一帧中,您在onLoad函数中加载菜单。
第二帧会有游戏代码,当你死后,你只需回到第一帧。我在想这个。。。我有两个场景。打开“开始”菜单,一个用于游戏。游戏场景中的另一个画面?
function fl_EnterFrameHandler(event:Event):void
{
if (isOver)
{
var overScreen = new over_screen();//adds the game over screen
overScreen.x = 240;
overScreen.y = 355;
var againButton = new again_button();//adds the play again button
againButton.x = 125;
againButton.y = 415;
var rateButton = new again_button();// adds the rate button
rateButton.x = 360;
rateButton.y = 415;
addChild(overScreen);
addChild(againButton);//adds the objects created above
addChild(rateButton);
stop(); //SHOULD stop the frame... I think? This is my problem
}
if (! isPaused && ! isOver) // the running code of the game, as long as it isnt paused or over
{
duck1.y += 5;
duck2.y += 5;
duck3.y += 5;
duck4.y += 5;
duck5.y += 5;
duck6.y += 5;
if (duck1.y > 620)
{
if (duck1.x < basket1.x + 50 && duck1.x > basket1.x - 50)
{
duck1.y = -50;
duck1.x = Math.random() * stage.stageWidth;
numScore++;
score.text = numScore.toString();
}
else
{
isOver = true;
}
}
if (duck2.y > 620)
{
if (duck2.x < basket1.x + 50 && duck2.x > basket1.x - 50)
{
duck2.y = -50;
duck2.x = Math.random() * stage.stageWidth;
numScore++;
score.text = numScore.toString();
}
else
{
isOver = true;
}
}
if (duck3.y > 620)
{
if (duck3.x < basket1.x + 50 && duck3.x > basket1.x - 50)
{
duck3.y = -50;
duck3.x = Math.random() * stage.stageWidth;
numScore++;
score.text = numScore.toString();
}
else
{
isOver = true;
}
}
if (duck4.y > 620)
{
if (duck4.x < basket1.x + 50 && duck4.x > basket1.x - 50)
{
duck4.y = -50;
duck4.x = Math.random() * stage.stageWidth;
numScore++;
score.text = numScore.toString();
}
else
{
isOver = true;
}
}
if (duck5.y > 620)
{
if (duck5.x < basket1.x + 50 && duck5.x > basket1.x - 50)
{
duck5.y = -50;
duck5.x = Math.random() * stage.stageWidth;
numScore++;
score.text = numScore.toString();
}
else
{
isOver = true;
}
}
if (duck6.y > 620)
{
if (duck6.x < basket1.x + 50 && duck6.x > basket1.x - 50)
{
duck6.y = -50;
duck6.x = Math.random() * stage.stageWidth;
numScore++;
score.text = numScore.toString();
}
else
{
isOver = true;
}
}
}
}