I have found this code in as2 and I am trying to make it have collision detection, with objects of different shapes but have been unable to do so. Does anyone know how to do this.
onClipEvent (load) {
theta = 0;
thrust = 0;
angle_inc = 5;
vx = 0;
vy = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
thrust = .1;
} else {
thrust = 0;
}
if (Key.isDown(Key.LEFT)) {
theta = theta-angle_inc;
} else if (Key.isDown(Key.RIGHT)) {
theta = theta+angle_inc;
}
if (Key.isDown(Key.DOWN)) {
thrust -= .1;
}
vx += thrust*Math.cos(theta/180*Math.PI);
vy += thrust*Math.sin(theta/180*Math.PI);
this._x += vx;
this._y += vy;
this._rotation = theta;
}