当我的时间计数器显示 0 (Flash Builder) 时,如何在主类中添加我的 GameOver-Page?
public function SeedsAndPots()
{
startpage = new StartPage();
addChild(startpage);
buttonPage = new ButtonPage();
addChild(buttonPage);
buttonPage.addEventListener(MouseEvent.CLICK, GoToGame);
}
public function GoToGame(e:MouseEvent):void
{
removeChild(startpage);
buttonPage.removeEventListener(MouseEvent.CLICK, GoToGame);
removeChild(buttonPage);
gamePage = new GamePage();
addChild(gamePage);
}
// 我想做一个函数,如果时间为 0,我应该转到我的 GameOver-Page。
}
}
public function SeedsAndPots()
{
startpage = new StartPage();
addChild(startpage);
buttonPage = new ButtonPage();
addChild(buttonPage);
buttonPage.addEventListener(MouseEvent.CLICK, GoToGame);
}
public function GoToGame(e:MouseEvent):void
{
removeChild(startpage);
buttonPage.removeEventListener(MouseEvent.CLICK, GoToGame);
removeChild(buttonPage);
gamePage = new GamePage();
addChild(gamePage);
}
// I wanna do a function that says that if time is 0 i should go to my GameOver-Page.
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个倒计时变量来反映时间(以秒为单位)。
当您加载游戏页面时实例化一个计时器以每秒倒计时。
当时间达到 0 时,应用逻辑结束当前关卡并显示游戏结束页面。
Create a countdown variable to reflect time in seconds.
Instantiate a timer when you load your game page to countdown every second.
When time has reached 0, apply the logic to end the current level and display your game over page.