Código :
bola.onEnterFrame = mover;
g = 10;
var ensuelo:Boolean;
function mover() {
if (this.x == undefined) {
this.x = this._x;
this.y = this._y;
}
if (terreno.hitTest(this.x, this.y, true)) {
ensuelo = true;
} else {
this.y += g-0.8;
}
if (ensuelo) {
if (Key.isDown(Key.RIGHT)) {
this.x += 5;
this.y = CoryA(this)+1;
}
if (Key.isDown(Key.LEFT)) {
this.x -= 5;
this.y = CoryA(this)+1;
}
this._x = this.x;
this._y = this.y;
}
function CoryA(ins) {
while (terreno.hitTest(ins.x, ins.y, true)) {
ins.y--;
}
return ins.y;
}
}
Lo que quiero hacer es que el personaje (bola), al darle a un boton (por ejemplo a la barra espacio del teclado), salte y que luego por el efecto de la gravedad, regrece al suelo, gracias de antemano. saludos
