求一个会简单active script 3.0 编码的 求教
action吧
全部回复
仅看楼主
level 1
bfgh之歌 楼主
Movieclip.prototype.calcdistance=function(mvc) {
var dx = this._x-mvc._x;
var dy = this._y-mvc._y;
return(Math.sqrt((dx*dx)+(dy*dy)));
}
Movieclip.prototype.calcradian=function(mvc) {
var dx = this._x-mvc._x;
var dy = this._y-mvc._y;
return (Math.atan2(dy, -dx));
}
Movieclip.prototype.cadrer=function(){
//this._width=20+Math.abs(this.yspeed)/2;
//this._height=20+Math.abs(this.xspeed)/2;
this._xscale=this._yscale=100+(this.vitesse()/2);
this.oldxpos = this._x;
this.oldypos = this._y;
this.newxpos = this.oldxpos+xspeed;
this.newypos = this.oldypos+yspeed;
this.xspeed = this.xspeed*_root.friction;
this.yspeed = this.yspeed*_root.friction;
if(this._name == "ball1"){_root.cue._alpha = 100-30*Math.sqrt((this.xspeed*this.xspeed)+(this.yspeed*this.yspeed));}
// collision with sides
if ((this.newypos<_root.miny) or (this.newypos>_root.maxy)) {
this.yspeed = -1*this.yspeed*_root.friction;
this.newypos = this.oldypos;
}else if ((this.newxpos<_root.minx) or (this.newxpos>_root.maxx)) {
this.xspeed = -1*this.xspeed*_root.friction;
this.newxpos = this.oldxpos;
}
this._x= this.newxpos;
this._y= this.newypos;
}
Movieclip.prototype.collision=function(mvc){
// distance between the two balls
distance = Math.sqrt((this.newxpos-mvc._x)*(this.newxpos-mvc._x)+(this.newypos-mvc._y)*(this.newypos-mvc._y));
if (distance<=_width/2+mvc._width/2) {
mvc.xspeed = this.xspeed;
mvc.yspeed = this.yspeed;
// change my x and y
this.newxpos = this.oldxpos;
this.newypos = this.oldypos;
// reverse my speed
this.xspeed = -1*this.xspeed*_root.friction;
this.yspeed = -1*this.yspeed*_root.friction;
}
}
Movieclip.prototype.vitesse=function(){
return(Math.abs(this.xspeed) + Math.abs(this.xspeed));
}
nb = 17;
// initialize variables
minx = 20;
maxx = 770;
miny = 20;
maxy = 380;
friction = 0.95;
stop ();
2017年03月03日 08点03分 1
level 1
都挺简单的。可以一个一个上百度查。
2017年03月15日 20点03分 2
1