Example #1
0
  @Override
  public void keyReleased(KeyEvent e) {
    Engine.keyReleased(character1, e.getKeyCode());

    if (e.getKeyCode() == KeyEvent.VK_C) {
      black = !black;
    } else if (e.getKeyCode() == KeyEvent.VK_Q) {
      character1.incrementMaxSpeed(0.1);
    } else if (e.getKeyCode() == KeyEvent.VK_A) {
      character1.incrementMaxSpeed(-0.1);
    } else if (e.getKeyCode() == KeyEvent.VK_W) {
      character1.incrementAcceleration(0.05);
    } else if (e.getKeyCode() == KeyEvent.VK_S) {
      character1.incrementAcceleration(-0.05);
    } else if (e.getKeyCode() == KeyEvent.VK_E) {
      character1.incrementFriction(0.05);
    } else if (e.getKeyCode() == KeyEvent.VK_D) {
      character1.incrementFriction(-0.05);
    } else if (e.getKeyCode() == KeyEvent.VK_R) {
      character1.incrementJump(0.5);
    } else if (e.getKeyCode() == KeyEvent.VK_F) {
      character1.incrementJump(-0.5);
    } else if (e.getKeyCode() == KeyEvent.VK_V) {
      character1.setJump(-character1.getJump());
    } else if (e.getKeyCode() == KeyEvent.VK_T) {
      character1.incrementGravity(0.05);
    } else if (e.getKeyCode() == KeyEvent.VK_G) {
      character1.incrementGravity(-0.05);
    } else if (e.getKeyCode() == KeyEvent.VK_B) {
      character1.setGravity(-character1.getGravity());
    }
  }
Example #2
0
  @Override
  public void update() {
    Engine.setControlSpeeds(character1);
    for (BBox box : walls) {
      CollisionEngine.wallCollision(character1, box);
    }

    for (BBox box : platforms) {
      CollisionEngine.platformCollision(character1, box);
    }

    character1.move();

    camera.updateCamera();
  }
Example #3
0
 @Override
 public void keyPressed(KeyEvent e) {
   Engine.keyPressed(character1, e.getKeyCode());
 }