示例#1
0
 public void walkRight() {
   if (isFlying()) {
     tiltRight();
   } else {
     super.moveRight(getVelocity());
   }
 }
示例#2
0
 public void walkLeft() {
   if (isFlying()) {
     tiltLeft();
   } else {
     super.moveLeft(getVelocity());
   }
 }
示例#3
0
  public void jump(float jumpVelocity) throws SlickException {
    super.jump(jumpVelocity);
    jumpSound.play();

    // int rand = (int) (Math.random() * 5) + 1;
    // super.playSound("audio/sfx/g2dp_jump_0" + rand + ".wav");
  }
示例#4
0
  @Override
  public void preUpdate(int delta) {
    super.preUpdate(delta);

    sprayX = this.getX();
    sprayY = this.getY() + 60;
    if (isFlying()) {
      fly();
      return;
    } else if (!this.isOnGround()) {
      // reduce the xVel smoothly, until they are hovering.
      this.setVelocity(this.getVelX() * 0.98f, this.getVelY());
      this.steadyTilt();
    } else if (isOnGround()) {
      setRotation(0);
      if (getNumberOfBeers() > 0) {
        remainingFuel = 100f;
      }
    }

    if (animationDelta < animationControl) {
      animationDelta += delta;
      return;
    } else {
      animationDelta -= animationControl;
      animateWalk(animationStep);
    }
  }
示例#5
0
  public Player(
      World world, int x, int y, int width, int height, float mass, String name, SoundWrapper swrap)
      throws SlickException {
    super(world, x, y, width, height, mass, name, swrap);
    super.setSoundWrapper(swrap);
    sheet =
        new XMLPackedSheet(
            "media/images/little_robot_sheet.png", "media/images/little_robot_sheet.png.xml");
    Image image = sheet.getSprite("little_robot_00.png");
    super.setImage(image);
    this.setFacingRight(true);
    initialImage = image;

    sprayImage = new Image("media/images/Spray.png");
    spraySound = new Sound("media/audio/sfx/spray01.ogg");
    jumpSound = new Sound("media/audio/sfx/jump01.ogg");

    rotationSpeed = 2.0f;
  }
示例#6
0
 public void update(GameContainer g, Game game, int delta) throws SlickException {
   super.update(delta);
   proj.preUpdate(delta);
   proj.update(delta);
 }