//en en movie clip caveza
Código ActionScript :
onClipEvent (enterFrame) {
this._y = _root.cuerpo._y;
this._x = _root.cuerpo._x;
this._rotation=_root.cuerpo._rotation;
}ahora en el clip cuerpo
Código ActionScript :
onClipEvent(load)
{
speed =0 ;
}
onClipEvent (enterFrame) {
// make the car go forward
if (Key.isDown(Key.UP)) {
speed += 1;
}
if (Key.isDown(Key.DOWN)) {
speed -= 1;
}
if (Math.abs(speed)>20) {
speed *= .7;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 15;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 15;
}
speed *= .9;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.land.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
daños += 1;
} else {
;
speed *= -1;
}
}
