Package com.badlogic.gdx.graphics.g2d

Examples of com.badlogic.gdx.graphics.g2d.Animation


    TextureRegion[][] frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    TextureRegion[] rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    rightAnimation = new Animation(0.15f, rightFrames);
   
    spriteSheet = ResourceManager.assets.get("player/player_left_animation.png", Texture.class);
    frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    leftAnimation = new Animation(0.15f, rightFrames);
   
    spriteSheet = ResourceManager.assets.get("player/player_up_animation.png", Texture.class);
    frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    upAnimation = new Animation(0.15f, rightFrames);
   
    spriteSheet = ResourceManager.assets.get("player/player_down_animation.png", Texture.class);
    frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    downAnimation = new Animation(0.15f, rightFrames);
   
    spriteSheet = ResourceManager.assets.get("player/player_explosion_animation.png", Texture.class);
    frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / (FRAMES * 2), spriteSheet.getHeight());
    rightFrames = new TextureRegion[FRAMES * 2];
    for (int i = 0; i < FRAMES * 2; i++) {
      rightFrames[i] = frames[0][i];
    }
    explosionAnimation = new Animation(0.2f, rightFrames);
  }
View Full Code Here


 
  public Enemy(float x, float y, String name, Direction direction, SpriteManager spriteManager) {
    super(x, y);
   
    this.name = name;
    animation = new Animation(0.15f, ResourceManager.assets.get("enemy/enemies.pack", TextureAtlas.class).findRegions(name));
   
    currentFrame = animation.getKeyFrame(0);
    rect.width = currentFrame.getRegionWidth();
    rect.height = currentFrame.getRegionHeight();
    this.direction = direction;
View Full Code Here

      break;
    default:
            break;
    }

        animation = new Animation(0.2f, atlas.findRegions(strType));
    currentFrame = animation.getKeyFrame(0);
    position = new Vector2(x, y);
  }
View Full Code Here

    TextureRegion[][] frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / nFrames, spriteSheet.getHeight());
    TextureRegion[] rightFrames = new TextureRegion[nFrames];
    for (int i = 0; i < nFrames; i++) {
      rightFrames[i] = frames[0][i];
    }
    animation = new Animation(0.15f, rightFrames);
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.g2d.Animation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.