两个玩家检查 socre 并显示结果(谁赢谁输谁平)AS3
Two player check socre and show result (who won lost or tie) AS3
请帮帮我
我正在尝试制作一款双人游戏,结果页面出现问题,我需要在结果页面上显示谁赢谁输或平局
这是我的 Flash 文件
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
}
好的,我们开始。
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.
}
请帮帮我
我正在尝试制作一款双人游戏,结果页面出现问题,我需要在结果页面上显示谁赢谁输或平局
这是我的 Flash 文件 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
}
好的,我们开始。
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.
}