コード例 #1
0
  public void updateArmor() {

    TextureFilm film = new TextureFilm(tiers(), ((Hero) ch).tier(), FRAME_WIDTH, FRAME_HEIGHT);

    idle = new Animation(1, true);
    idle.frames(film, 0, 0, 0, 1, 0, 0, 1, 1);

    run = new Animation(RUN_FRAMERATE, true);
    run.frames(film, 2, 3, 4, 5, 6, 7);

    die = new Animation(20, false);
    die.frames(film, 8, 9, 10, 11, 12, 11);

    attack = new Animation(15, false);
    attack.frames(film, 13, 14, 15, 0);

    zap = attack.clone();

    operate = new Animation(8, false);
    operate.frames(film, 16, 17, 16, 17);

    fly = new Animation(1, true);
    fly.frames(film, 18);

    read = new Animation(20, false);
    read.frames(film, 19, 20, 20, 20, 20, 20, 20, 20, 20, 19);
  }
コード例 #2
0
  private Animation readAnimation(JSONObject root, String animKind, TextureFilm film) {
    try {

      JSONObject jsonAnim = root.getJSONObject(animKind);

      Animation anim = new Animation(jsonAnim.getInt("fps"), jsonAnim.getBoolean("looped"));

      List<Integer> framesSeq = new ArrayList<Integer>(16);

      JSONArray jsonFrames = jsonAnim.getJSONArray("frames");

      int nextFrame;

      for (int i = 0; (nextFrame = jsonFrames.optInt(i, -1)) != -1; ++i) {
        framesSeq.add(nextFrame);
      }

      anim.frames(film, framesSeq, kind * framesInRow);

      return anim;
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return null;
  }
コード例 #3
0
  private Animation readAnimation(JSONObject root, String animKind, TextureFilm film)
      throws JSONException {
    JSONObject jsonAnim = root.getJSONObject(animKind);

    Animation anim = new Animation(jsonAnim.getInt("fps"), jsonAnim.getBoolean("looped"));

    List<Integer> framesSeq = new ArrayList<Integer>(16);

    JSONArray jsonFrames = jsonAnim.getJSONArray("frames");

    int nextFrame;

    for (int i = 0; (nextFrame = jsonFrames.optInt(i, -1)) != -1; ++i) {
      framesSeq.add(nextFrame);
    }

    anim.frames(film, framesSeq, kind * framesInRow);

    return anim;
  }
コード例 #4
0
  public MonkSprite() {
    super();

    texture(Assets.MONK);

    TextureFilm frames = new TextureFilm(texture, 15, 14);

    idle = new Animation(6, true);
    idle.frames(frames, 1, 0, 1, 2);

    run = new Animation(15, true);
    run.frames(frames, 11, 12, 13, 14, 15, 16);

    attack = new Animation(12, false);
    attack.frames(frames, 3, 4, 3, 4);

    kick = new Animation(10, false);
    kick.frames(frames, 5, 6, 5);

    die = new Animation(15, false);
    die.frames(frames, 1, 7, 8, 8, 9, 10);

    play(idle);
  }