Package javaPlay

Examples of javaPlay.Keyboard


  }

  //M�todo executado a cada itera��o do jogo.
  public void step(long timeElapsed) {

    Keyboard k = GameEngine.getInstance().getKeyboard();
    if (k.keyDown(Keyboard.RIGHT_KEY)) {
      jogador.aumentaVelocidadeHorizontal();
    }
    if (k.keyDown(Keyboard.LEFT_KEY)) {
      jogador.diminuiVelocidadeHorizontal();
    }
    if (k.keyDown(Keyboard.SPACE_KEY)) {
      jogador.mudaCor();
    }
    if (k.keyDown(KeyEvent.VK_P)) {
      jogador.para();
    }
   
   
    if (k.keyDown(KeyEvent.VK_D)) {
      jogador2.aumentaVelocidadeHorizontal();
    }
    if (k.keyDown(KeyEvent.VK_A)) {
      jogador2.diminuiVelocidadeHorizontal();
    }
    if (k.keyDown(KeyEvent.VK_S)) {
      jogador2.aumentaVelocidadeVertical();
    }
    if (k.keyDown(KeyEvent.VK_W)) {
      jogador2.diminuiVelocidadeVertical();
    }

    jogador.step(timeElapsed);
    jogador2.step(timeElapsed);
View Full Code Here


    this.y = 50;
  }
 
  public void step(long timeElapsed) {
    //pega o objeto respons�vel pelo teclado
    Keyboard k = GameEngine.getInstance().getKeyboard();

    //Verifica se uma tecla direcional est� pressionado
    //Em caso positivo, altera a posi��o do jogador
    if(k.keyDown(Keyboard.DOWN_KEY)){
      this.y += this.velocidade;
    }
    if(k.keyDown(Keyboard.UP_KEY)){
      this.y -= this.velocidade;
    }
    if(k.keyDown(Keyboard.LEFT_KEY)){
      this.x -= this.velocidade;
    }
    if(k.keyDown(Keyboard.RIGHT_KEY)){
      this.x += this.velocidade;
    }
  }
View Full Code Here

      this.raios[i].draw(g);
    }
  }

  private void acoesTeclado(){
    Keyboard k = GameEngine.getInstance().getKeyboard();
    if(k.keyDown(Keyboard.RIGHT_KEY)){
      jogador.aumentaVelocidadeHorizontal();
    }
    if(k.keyDown(Keyboard.LEFT_KEY)){
      jogador.diminuiVelocidadeHorizontal();
    }
    if(k.keyDown(KeyEvent.VK_P)){
      this.pause = !this.pause;
    }
  }
View Full Code Here

    this.diametro = 20;
  }
 
  public void step(long timeElapsed) {
    //pega o objeto respons�vel pelo teclado
    Keyboard k = GameEngine.getInstance().getKeyboard();

    //Verifica se uma tecla direcional est� pressionado
    //Em caso positivo, altera a posi��o do jogador
    if(k.keyDown(Keyboard.DOWN_KEY)){
      this.y += this.velocidade;
    }
    if(k.keyDown(Keyboard.UP_KEY)){
      this.y -= this.velocidade;
    }
    if(k.keyDown(Keyboard.LEFT_KEY)){
      this.x -= this.velocidade;
    }
    if(k.keyDown(Keyboard.RIGHT_KEY)){
      this.x += this.velocidade;
    }
  }
View Full Code Here

    this.y = 50;
  }
 
  public void step(long timeElapsed) {
    //pega o objeto respons�vel pelo teclado
    Keyboard k = GameEngine.getInstance().getKeyboard();

    //Verifica se uma tecla direcional est� pressionado
    //Em caso positivo, altera a posi��o do jogador
    if(k.keyDown(Keyboard.DOWN_KEY)){
      this.y += this.velocidade;
    }
    if(k.keyDown(Keyboard.UP_KEY)){
      this.y -= this.velocidade;
    }
    if(k.keyDown(Keyboard.LEFT_KEY)){
      this.x -= this.velocidade;
    }
    if(k.keyDown(Keyboard.RIGHT_KEY)){
      this.x += this.velocidade;
    }
  }
View Full Code Here

TOP

Related Classes of javaPlay.Keyboard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.