コード例 #1
0
  public void update() {
    move();

    if (walking) animSprite.update();
    else animSprite.setFrame(0);
    if (ya < 0) {
      dir = Direction.UP;
      animSprite = up;
    } else if (ya > 0) {
      dir = Direction.DOWN;
      animSprite = down;
    }
    if (xa < 0) {
      dir = Direction.LEFT;
      animSprite = left;
    } else if (xa > 0) {
      dir = Direction.RIGHT;
      animSprite = right;
    }
  }
コード例 #2
0
 public void render(Screen screen) {
   sprite = animSprite.getSprite();
   screen.renderMob((int) (x - 16), (int) (y - 16), this);
 }