beeblebrox
06-26-2008, 10:16 AM
A long time ago I've made this nice rocket fumes effect
using code provided by a tutorial...
Now I want to build this effect into my new game.
But it doesn't work because of AS 1/2 differences.
any help how to transcribe the fumes script to AS 2 would be appreciated.
heres the code:
Mouse.hide();
function Sterne() {
this._x = _root._xmouse-5;
this._y = _root._ymouse+68;
this.pX = 0;
this.pY = 0;
this.onEnterFrame = function() {
this._x += this.pX;
this._y += this.pY;
this.pX += Math.random()*6-3;
this.pY += 1;
if (this._x>Stage.width || this._x<0 || this._y>Stage.height || this._y<0 || this._alpha<1) {
this.removeMovieClip();
}
};
}
Sterne.prototype = new MovieClip();
Object.registerClass("sClip", Sterne);
minAbstand = 1;
this.onMouseMove = function() {
var diffX = this._xmouse-posX;
var diffY = this._ymouse-posY;
var abstand = Math.sqrt(diffX*diffX+diffY*diffY);
if (abstand>minAbstand) {
attachMovie("sClip", "stern_mc"+i, i+500);
posX = this._xmouse;
posY = this._ymouse;
i++;
}
updateAfterEvent();
};
and here's the fla & swf:
using code provided by a tutorial...
Now I want to build this effect into my new game.
But it doesn't work because of AS 1/2 differences.
any help how to transcribe the fumes script to AS 2 would be appreciated.
heres the code:
Mouse.hide();
function Sterne() {
this._x = _root._xmouse-5;
this._y = _root._ymouse+68;
this.pX = 0;
this.pY = 0;
this.onEnterFrame = function() {
this._x += this.pX;
this._y += this.pY;
this.pX += Math.random()*6-3;
this.pY += 1;
if (this._x>Stage.width || this._x<0 || this._y>Stage.height || this._y<0 || this._alpha<1) {
this.removeMovieClip();
}
};
}
Sterne.prototype = new MovieClip();
Object.registerClass("sClip", Sterne);
minAbstand = 1;
this.onMouseMove = function() {
var diffX = this._xmouse-posX;
var diffY = this._ymouse-posY;
var abstand = Math.sqrt(diffX*diffX+diffY*diffY);
if (abstand>minAbstand) {
attachMovie("sClip", "stern_mc"+i, i+500);
posX = this._xmouse;
posY = this._ymouse;
i++;
}
updateAfterEvent();
};
and here's the fla & swf: