el codigo de mi car es este.
Código ActionScript :
onClipEvent (load) {
speed = 0;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.aleronx1encarropiso)) {
if (_root.vcam.gasolina._currentframe<=1000) {
if (_root.vcam.aguja._rotation<=180) {
_root.vcam.aguja._rotation = speed*16;
}
//This code will advance the car forward.
if (Key.isDown(Key.UP)) {
_root.vcam.gasolina.nextFrame();
speed += 1;
_root.aleronx1encarropiso.wel1._rotation = 0;
_root.aleronx1encarropiso.wel2._rotation = 0;
} else {
// This will make the car go backwards
if (Key.isDown(Key.DOWN)) {
_root.vcam.gasolina.nextFrame();
_root.aleronx1encarropiso.wel1._rotation = 0;
_root.aleronx1encarropiso.wel2._rotation = 0;
speed -= 1;
} else {
speed *= _root.handling;
}
}
//The car will start to slow down after the speed of 25
// This will change the angle of the car
if (Key.isDown(Key.LEFT)) {
_rotation -= speed/2;
_root.aleronx1encarropiso.wel1._rotation = 20;
_root.aleronx1encarropiso.wel2._rotation = 20;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += speed/2;
_root.aleronx1encarropiso.wel1._rotation = 160;
_root.aleronx1encarropiso.wel2._rotation = 160;
}
// This will make the car move
speed *= _root.nivelmotor;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.move.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.9;
}
}
} else {
if (this._currentframe<=2) {
if (Key.isDown(Key.UP)) {
this._y -= 6;
this._rotation = 359;
} else if (Key.isDown(Key.DOWN)) {
this._y += 6;
this._rotation = 180;
} else if (Key.isDown(Key.LEFT)) {
this._x -= 6;
this._rotation = 270;
} else if (Key.isDown(Key.RIGHT)) {
this._x += 6;
this._rotation = 90;
}
}
}
}

