请帮我
我正在尝试制作一个两人游戏并面临结果页面的问题,我需要在结果页面上显示谁赢了输或平局
这是我的闪存档案 https://drive.google.com/file/d/1wGQh1UXlsQXQT1ofyubljxgWQJelB7GE/view?usp=sharing
stop();
//for tow players
var p_1_scoreCount:Number = 0;
var p_2_scoreCount:Number = 0;
stage.addEventListener(KeyboardEvent.KEY_UP, detectKey);
function detectKey(event:KeyboardEvent):void {
// player 1 keyboard kye A
if (event.keyCode == 65){
p_1_scoreCount = 1;
p_1_score.text = String(p_1_scoreCount);
}
// player 2 keyboard kye B
if (event.keyCode == 66){
p_2_scoreCount = 1;
p_2_score.text = String(p_2_scoreCount);
}
}
///for coundown
var nCount:Number = 10;
var myTimer:Timer = new Timer(1000, nCount);
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, completeHandler);
timer_txt.text = nCount.toString();
myTimer.start();
myTimer.addEventListener(TimerEvent.TIMER, countdown);
function countdown(e:TimerEvent):void
{
nCount--;
timer_txt.text = nCount.toString();
}
// 10 Sec finish it will go to result page
function completeHandler(event:TimerEvent):void {
gotoAndStop("result"); //Result Page
}
uj5u.com热心网友回复:
好的,我们开始吧。
if (p_1_scoreCount > p_2_scoreCount)
{
// Player №1 is winner.
}
else if (p_1_scoreCount < p_2_scoreCount)
{
// Player №2 is winner.
}
else
{
// It's a draw.
}
0 评论