請幫助我
。我想做一個雙人游戲,但在結果頁上面臨一個問題,我需要在結果頁上顯示誰贏了,誰輸了,或者是否平局
這里是我的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 {
//玩家1鍵盤kye A。
if (event.keyCode == 65) {
p_1_scoreCount = 1;
p_1_score.text = String(p_1_scoreCount)。
}
//玩家2鍵盤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秒完成后將進入結果頁面。
function completeHandler(event:TimerEvent):void {
gotoAndStop("result"); /result page
}
uj5u.com熱心網友回復:
好,我們開始吧。
if (p_1_scoreCount > p_2_scoreCount)
{
//玩家№1是贏家。。
}
else if (p_1_scoreCount < p_2_scoreCount)
{
//Player №2是贏家。。
}
else }
{
// It's a draw.
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/319496.html
標籤:
