主题:  帮忙解释一下几段as

7975475

职务:普通成员
等级:1
金币:0.0
发贴:6
注册:2004/5/20 17:26:57
#12004/6/1 17:00:02
onClipEvent (enterFrame) {
    // animate mosquito
    _parent._x = _parent._x+xstep;
    _parent._y = _parent._y+(Math.sin(_parent._x/100)*ystep);
    if (_parent._x<-30 and xstep<0) {
        // make the game easier and turn the direction
        xstep = -(xstep-(xstep/16));
        ystep = -(ystep-(ystep/16));
        scale = _parent._yscale+4;
        _parent._xscale = scale;
        _parent._yscale = scale;
    } else if (_parent._x>670 and xstep>0) {
        // make the game easier and turn the direction
        xstep = -(xstep-(xstep/16));
        ystep = -(ystep-(ystep/16));
        scale = _parent._yscale+4;
        _parent._xscale = -scale;
        _parent._yscale = scale;
    }


// init for standalone player
fscommand("fullscreen", true);
fscommand("allowscale", true);
fscommand("showmenu", false);
// init
level=0;
hit=0;
score=0;
changeCursor("swatter");


if (hit==level) {
    if (level<8) {
        // limit to 8 mosquitos
        level++;
    }
    hit=0;
    createMosquitos(level);
}
prevFrame();
play();


function createMosquitos(count) {
    // create mosquitos
    var i;
    for (i=1; i<=count; i++) {
        _root.attachMovie("mosquito", "mosquito"+i, i);
    }
}
function changeCursor(movieclip) {
    // create custom cursor
    Mouse.hide();
    _root.attachMovie(movieclip, "customCursor", 9999);
    _root.customCursor.startDrag(true);
}
function calculateRandom(min, max) {
    // random with the math object (Flash 5)
    return Math.floor(Math.random()*(max+1-min))+min;
}
function playSound(max, x, soundID) {
    // play stereo sound depending on the x-position of the action
    var soundobject;
    soundobject = new Sound();
    soundobject.attachSound(soundID);
    if (x<0) {
        x = 0;
    } else if (x>max) {
        x = max;
    }
    soundobject.setPan((x-(max/2))*100/(max/2));
    soundobject.start();
}
谢谢了!!!!!老师让我讲!