home *** CD-ROM | disk | FTP | other *** search
- Sprite = function()
- {
- this.vitesse = 0;
- this.trajectoire = "nothing";
- };
- Sprite.prototype = new MovieClip();
- Sprite.prototype.onEnterFrame = function()
- {
- this.move();
- };
- Sprite.prototype.move = function()
- {
- switch(this.trajectoire)
- {
- case "sinus":
- this.moveSinus();
- break;
- case "cercle":
- this.moveCercle();
- break;
- case "droite":
- this.moveDroite();
- break;
- case "atan":
- this.moveATan();
- }
- if(this._x < -50)
- {
- this.removeMovieClip();
- }
- };
- Sprite.prototype.moveDroite = function()
- {
- this._x += this.vitesse * Math.cos(this.angle);
- this._y += this.vitesse * Math.sin(this.angle);
- };
- Sprite.prototype.moveCercle = function()
- {
- this.savex += this.vitesse * -1;
- this.savey += this.vitesse * 1.2246063538223773e-16;
- this._x = this.savex + this.rayonx * Math.cos(this.angle += 0.1);
- this._y = this.savey + this.rayony * Math.sin(this.angle);
- };
- Sprite.prototype.moveSinus = function()
- {
- this._x += this.vitesse * Math.cos(this.angle);
- this._y = this.savey + Math.sin(this._x * 3.141592653589793 / 180) * 50;
- };
- Sprite.prototype.moveATan = function()
- {
- this._x += this.vitesse * Math.cos(this.angle);
- this._y = this.savey + Math.atan((this._x - 580) / this.largeur) * this.hauteur;
- };
-