#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();
}
谢谢了!!!!!老师让我讲!