예제 #1
0
파일: Hero.java 프로젝트: rweichler/wuigi
  /**
   * makes this jump
   *
   * @param pressed true if jump button is down
   * @param sound true if should play sound
   */
  public void jump(boolean pressed, boolean sound) {
    if (dead) return;
    if (pressed) jumpDown = true;
    else jumpDown = false;
    if (cape) {
      if (pressed) {
        movingUp = true;
        acc.y = Wuigi.GRAVITY;
        jumping = true;
      } else {
        movingUp = false;
        jumping = false;
        acc.y = 0;
      }
      return;
    }

    if (pressed) {
      if (vel.y == 0) {
        vel.y = JUMP_VEL + Wuigi.GRAVITY;
        jumping = true;
        jumpAdd = Wuigi.COMPLETE_JUMP_TIME;
        if (sound) JUMP.start();
      }
    } else {
      jumpAdd = -Wuigi.COMPLETE_JUMP_TIME;
    }
  }
예제 #2
0
파일: Hero.java 프로젝트: rweichler/wuigi
  /** shoots the AWP */
  public void shootAWP(int x, int y) {
    if (numBullets > 0) {
      numBullets--;
      AWP.start();
      shotTime = System.currentTimeMillis();
      ammo.setText("" + numBullets);

      double awpx = pos.x + width / 2;
      double awpy = pos.y + height / 2;

      double mousex = x + this.pos.x - (Wuigi.screenWidth / 2.0 + xOffset());
      double mousey = Wuigi.screenHeight + pos.y + 32 - (ScreenManager.mouse.y + yOffset());

      addSpawn(new AWPBullet(awpx, awpy, mousex, mousey));
    }
  }