Código :
if(Pista.hitTest(_root.car)){
velocidad =0
}Ese codigo lo puse en el fotograma de la pista.
PD: el auto tiene las siguientes acciones por si quieren saber
Código :
onClipEvent (enterFrame) {
_root.speed = speed;
_root.mph = Number(speed)*2;
_root.mph -= _root.mph%1;
if (_root.mph<1) {
_root.mph = 1;
}
if (Key.isDown(Key.UP)) {
speed += 6;
}
if (Key.isDown(Key.DOWN)) {
speed -= 1;
}
if (Math.abs(speed)>20) {
speed *= .7;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 14;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 14;
}
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.boundary.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.6;
}
}
onClipEvent (enterFrame) {
if (this._x>600) {
this._x = -50;
}
}
onClipEvent (enterFrame) {
if (this._y>450) {
this._y = -50;
}
}
onClipEvent (enterFrame) {
if (this._x<-50) {
this._x = 600;
}
}
onClipEvent (enterFrame) {
if (this._y<-50) {
this._y = 450;
}
} 