public void frameTest() {
    Image TestImage;
    Image TestImage2;
    TestImage = loadImage("images/Tank.jpg");
    TestImage2 = loadImage("images/Tank.jpg");
    Animation AnimTest = new Animation();
    AnimTest.addFrame(TestImage, 200);

    Animation AnimTest2 = new Animation();
    AnimTest2.addFrame(TestImage2, 500);
    System.out.println(AnimTest.getImage());
    System.out.println(AnimTest2.getImage());
  }
Esempio n. 2
0
  public void loadImages() {
    // load images
    bgImage = loadImage("images/background.jpg");
    Image player1 = loadImage("images/player1.png");
    Image player2 = loadImage("images/player2.png");
    Image player3 = loadImage("images/player3.png");

    // create animation
    anim = new Animation();
    anim.addFrame(player1, 250);
    anim.addFrame(player2, 150);
    anim.addFrame(player1, 150);
    anim.addFrame(player2, 150);
    anim.addFrame(player3, 200);
    anim.addFrame(player2, 150);
  }
  public MainMenuScreen(Game game) {
    super(game);

    Assets.loadScreen.getBitmap().recycle();
    menu = new Animation();
    menu.addFrame(Assets.menu1, 150);
    menu.addFrame(Assets.menu2, 150);
    menu.addFrame(Assets.menu3, 150);
    menu.addFrame(Assets.menu4, 150);
    menu.addFrame(Assets.menu5, 150);
    menu.addFrame(Assets.menu6, 150);
    menu.addFrame(Assets.menu7, 150);
    Assets.theme = game.getAudio().createMusic("positheme3.mp3");
    Assets.theme.setLooping(true);
    loaded = false;
  }
Esempio n. 4
0
 public GIFAnimation(String fileName) {
   this.gifDecoder = new GIFDecoder();
   this.gifDecoder.read(fileName);
   RectBox d = gifDecoder.getFrameSize();
   this.width = (int) d.getWidth();
   this.height = (int) d.getHeight();
   this.isVisible = true;
   this.animation = new Animation();
   int delay;
   for (int i = 0; i < gifDecoder.getFrameCount(); i++) {
     delay = gifDecoder.getDelay(i);
     animation.addFrame(gifDecoder.getFrame(i).getTexture(), delay == 0 ? 100 : delay);
   }
 }