i've tried 3 or 4 but i couldn't get any to work right
thanks
![]() | It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!) |

|
|
|
|
Moderator: Phate





function makeShip (){
ship.angle = 0;
ship.xv = 0;
ship.x = 0;
ship.y = 0;
ship.yv = 0;
ship.xa = 0;
ship.ya = 0;
ship.v = 0;
ship.visc = 0.02;
ship.drag = 0;
mp = Math.PI, mpow = Math.pow, msr = Math.sqrt;
ship.onEnterFrame = function() {
if (Key.isDown(Key.RIGHT)) {
this.torque = 5;
} else if (Key.isDown(Key.LEFT)) {
this.torque = -5;
} else {
this.torque = 0;
}
this.rtorque = 0.5*this.AngVelocity;
this.AngAcceleration = this.torque-this.rtorque;
this.AngVelocity += this.AngAcceleration;
this.angle += this.AngVelocity;
if (this.angle<0) {
this.angle += 360;
}
if (this.angle>360) {
this.angle -= 360;
}
this.v = msr(mpow(this.xv, 2)+mpow(this.yv, 2));
this.drag = this.visc*this.v;
if (Key.isDown(Key.UP)) {
this.force = 1;
} else {
this.force = 0;
}
this.xa = ((this.drag*this.xv)*-1)+(this.force*Math.sin(mp/180*this.angle));
this.ya = ((this.drag*this.yv)*-1)-(this.force*Math.cos(mp/180*this.angle));
this.xv += this.xa;
this.yv += this.ya;
this._y += this.yv;
this._x += this.xv;
this._rotation = this.angle;
};
}
function Game() {
doo = new makeShip();
}
foo=new Game();

Users browsing this forum: No registered users and 0 guests