猴子 發問時間: 社會與文化語言 · 1 0 年前

可以幫我翻譯這段FLASH程式碼嗎?

//---------- IMPORT AND INCLUDE STATEMENTS

//---------- DECLARE VARIABLES AND CREATE OBJECTS

var gameFinished:Boolean = false;

var timer:Object = new Object();

var seconds:Number = 5;

var frameRate:Number = 12;

var timeLeft:Number = seconds*frameRate;

var padding:Number = 50;

var maxX:Number = Stage.width-all_mc.face_mc._width-padding;

var maxY:Number = Stage.height-all_mc.face_mc._height-padding;

//---------- DEFINE FUNCTIONS

timer.countDown = function():Void {

timeLeft--;

if (timeLeft<=0) {

gameFinished = true;

all_mc.face_mc.gotoAndStop(3);

all_mc.setMask(null);

Mouse.show();

mask_mc._visible = false;

}

};

function randomRange(min:Number, max:Number):Number {

var range:Number = max-min;

var randomNumber:Number = Math.random()*range+min;

return randomNumber;

}

function startGame():Void {

all_mc.face_mc._x = randomRange(padding, maxX);

all_mc.face_mc._y = randomRange(padding, maxY);

gameFinished = false;

all_mc.face_mc.gotoAndStop(1);

mask_mc.startDrag(true);

Mouse.hide();

all_mc.setMask(mask_mc);

timeLeft = seconds*frameRate;

_root.onEnterFrame = timer.countDown;

}

//---------- DEFINE EVENT HANDLERS

all_mc.face_mc.onRelease = function():Void {

if (gameFinished) {

startGame();

} else {

gameFinished = true;

all_mc.face_mc.gotoAndStop(2);

all_mc.setMask(null);

mask_mc._visible = false;

Mouse.show();

delete _root.onEnterFrame;

}

};

//---------- RUN IMMEDIATELY

startGame()

2 個解答

評分
  • 1 0 年前
    最佳解答

    //----------進口和包括聲明 //----------進口和包括聲明 //----------宣稱可變物并且創造對象 var gameFinished :布爾=錯誤; var定時器:對象=新的對象(); var秒鐘:數字= 5; var frameRate :數字= 12; var timeLeft :數字= seconds*frameRate; var填料:數字= 50; var maxX :_width-padding數字=的Stage.width-all_mc.face_mc。; var maxY :_height-padding數字=的Stage.height-all_mc.face_mc。; //----------定义了作用 timer.countDown =作用() :空隙{ timeLeft--; 如果(timeLeft

    參考資料: me&網路
  • 1 0 年前

    沒有原始檔無法明確知道各元件指定名稱的作用,

    裡面的程式碼實際上都很簡單,

    如果你有心要學,不應該是把人家的程式碼整段po上來,

    而是不懂的地方再發問.

    想學新技術就不要太懶惰了~

還有問題?馬上發問,尋求解答。