Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/02/2011, 10:26
Frankpro
 
Fecha de Ingreso: febrero-2011
Mensajes: 1
Antigüedad: 13 años, 3 meses
Puntos: 0
if(Key.isDown(Key.RIGHT)){

Haber estoy intentando hacer un juego, y quisiera ponerlo para dos jugadores, entonces vi que el codigo (que vi por hay) dice:

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.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)){

}
}
}
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í:

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)){

}
}
}