Cita:
entonces pensé, pues si "if(Key.isDown(Key.SPACE)){" hace que al pulsar espacio haga la función, pues cambio las teclas por W,A,S,D y listo, pero no funciona, como debo indicar que es dicha tecla? he probado así:onClipEvent(load){
veloc = 7;
grav = 0;
r = _height/2;
suel = false;
salto = 15;
}
onClipEvent(enterFrame){
grav++;
this._y+=grav;
if(_root.suelo.hitTest(this._x,this._y+r,true)){
grav = -1;
suel = true;
}else{
suel = false;
}
if(Key.isDown(Key.RIGHT)){
this._x+=veloc;
this._xscale = 100;
}
if(Key.isDown(Key.LEFT)){
this._x-=veloc;
this._xscale = -100;
}
if(Key.isDown(Key.UP)&& suel){
grav = -salto;
}
if(Key.isDown(Key.SPACE)){
this.play();
if(this.espa.hitTest(_root.malo._x,_root.malo._y,t rue)){
}
}
}
veloc = 7;
grav = 0;
r = _height/2;
suel = false;
salto = 15;
}
onClipEvent(enterFrame){
grav++;
this._y+=grav;
if(_root.suelo.hitTest(this._x,this._y+r,true)){
grav = -1;
suel = true;
}else{
suel = false;
}
if(Key.isDown(Key.RIGHT)){
this._x+=veloc;
this._xscale = 100;
}
if(Key.isDown(Key.LEFT)){
this._x-=veloc;
this._xscale = -100;
}
if(Key.isDown(Key.UP)&& suel){
grav = -salto;
}
if(Key.isDown(Key.SPACE)){
this.play();
if(this.espa.hitTest(_root.malo._x,_root.malo._y,t rue)){
}
}
}
Cita:
onClipEvent(load){
veloc = 7;
grav = 0;
r = _height/2;
suel = false;
salto = 15;
}
onClipEvent(enterFrame){
grav++;
this._y+=grav;
if(_root.suelo.hitTest(this._x,this._y+r,true)){
grav = -1;
suel = true;
}else{
suel = false;
}
if(Key.isDown(Key.'D')){
this._x+=veloc;
this._xscale = 100;
}
if(Key.isDown(Key.'A')){
this._x-=veloc;
this._xscale = -100;
}
if(Key.isDown(Key.'W')&& suel){
grav = -salto;
}
if(Key.isDown(Key.'S')){
this.play();
if(this.espa.hitTest(_root.malo._x,_root.malo._y,t rue)){
}
}
}
veloc = 7;
grav = 0;
r = _height/2;
suel = false;
salto = 15;
}
onClipEvent(enterFrame){
grav++;
this._y+=grav;
if(_root.suelo.hitTest(this._x,this._y+r,true)){
grav = -1;
suel = true;
}else{
suel = false;
}
if(Key.isDown(Key.'D')){
this._x+=veloc;
this._xscale = 100;
}
if(Key.isDown(Key.'A')){
this._x-=veloc;
this._xscale = -100;
}
if(Key.isDown(Key.'W')&& suel){
grav = -salto;
}
if(Key.isDown(Key.'S')){
this.play();
if(this.espa.hitTest(_root.malo._x,_root.malo._y,t rue)){
}
}
}