com.badlogic.gdx.graphics.g2d.Animation.setPlayMode()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中com.badlogic.gdx.graphics.g2d.Animation.setPlayMode()方法的一些代码示例,展示了Animation.setPlayMode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Animation.setPlayMode()方法的具体详情如下:
包路径:com.badlogic.gdx.graphics.g2d.Animation
类名称:Animation
方法名:setPlayMode

Animation.setPlayMode介绍

[英]Sets the animation play mode.
[中]设置动画播放模式。

代码示例

代码示例来源:origin: libgdx/libgdx

/** Constructor, storing the frame duration and key frames.
 * 
 * @param frameDuration the time between frames in seconds.
 * @param keyFrames the objects representing the frames. If this Array is type-aware, {@link #getKeyFrames()} can
 * return the correct type of array. Otherwise, it returns an Object[].*/
public Animation (float frameDuration, Array<? extends T> keyFrames, PlayMode playMode) {
  this(frameDuration, keyFrames);
  setPlayMode(playMode);
}

代码示例来源:origin: libgdx/libgdx

/** Constructor, storing the frame duration and key frames.
 * 
 * @param frameDuration the time between frames in seconds.
 * @param keyFrames the objects representing the frames. If this Array is type-aware, {@link #getKeyFrames()} can
 * return the correct type of array. Otherwise, it returns an Object[].*/
public Animation (float frameDuration, Array<? extends T> keyFrames, PlayMode playMode) {
  this(frameDuration, keyFrames);
  setPlayMode(playMode);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  // load the koala frames, split them, and assign them to Animations
  koalaTexture = new Texture("data/maps/tiled/super-koalio/koalio.png");
  TextureRegion[] regions = TextureRegion.split(koalaTexture, 18, 26)[0];
  stand = new Animation(0, regions[0]);
  jump = new Animation(0, regions[1]);
  walk = new Animation(0.15f, regions[2], regions[3], regions[4]);
  walk.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);
  // figure out the width and height of the koala for collision
  // detection and rendering by converting a koala frames pixel
  // size into world units (1 unit == 16 pixels)
  Koala.WIDTH = 1 / 16f * regions[0].getRegionWidth();
  Koala.HEIGHT = 1 / 16f * regions[0].getRegionHeight();
  // load the map, set the unit scale to 1/16 (1 unit == 16 pixels)
  map = new TmxMapLoader().load("data/maps/tiled/super-koalio/level1.tmx");
  renderer = new OrthogonalTiledMapRenderer(map, 1 / 16f);
  // create an orthographic camera, shows us 30x20 units of the world
  camera = new OrthographicCamera();
  camera.setToOrtho(false, 30, 20);
  camera.update();
  // create the Koala we want to move around the world
  koala = new Koala();
  koala.position.set(20, 20);
  debugRenderer = new ShapeRenderer();
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** Constructor, storing the frame duration and key frames.
 * 
 * @param frameDuration the time between frames in seconds.
 * @param keyFrames the objects representing the frames. If this Array is type-aware, {@link #getKeyFrames()} can
 * return the correct type of array. Otherwise, it returns an Object[].*/
public Animation (float frameDuration, Array<? extends T> keyFrames, PlayMode playMode) {
  this(frameDuration, keyFrames);
  setPlayMode(playMode);
}

代码示例来源:origin: jmrapp1/SpaceInvaders

public AnimatedSprite(Animation anim) {
  this.anim = anim;
  if (anim != null)
    anim.setPlayMode(PlayMode.LOOP);
}

代码示例来源:origin: jmrapp1/SpaceInvaders

public AnimatedSprite(Animation anim, PlayMode playMode) {
  this.anim = anim;
  if (anim != null)
    anim.setPlayMode(playMode);
}

代码示例来源:origin: jmrapp1/SpaceInvaders

public void setAnimation(Animation anim, PlayMode playMode) {
  this.anim = anim;
  anim.setPlayMode(playMode);
}

代码示例来源:origin: jmrapp1/SpaceInvaders

public void setAnimation(Animation anim) {
  this.anim = anim;
  anim.setPlayMode(PlayMode.LOOP);
}

代码示例来源:origin: Var3D/var3dframe

public void setPlayMode(PlayMode playMode) {
  this.playMode = playMode;
  animation.setPlayMode(playMode);
}

代码示例来源:origin: stackoverflow.com

public Animation walking;

public void initAnims() {
  walking= new Animation(1/10f,
    atlas.findRegion("1"),
    atlas.findRegion("2"),
    atlas.findRegion("3"),
    atlas.findRegion("4"),
    atlas.findRegion("5"),
    atlas.findRegion("6"),
    atlas.findRegion("7"), 
    atlas.findRegion("8"),
    atlas.findRegion("9"),
    atlas.findRegion("10"));
    walking.setPlayMode(Animation.LOOP);

//Init other anims here
}

代码示例来源:origin: moribitotech/MTX

this.animationMomentary.setPlayMode(Animation.NORMAL);
this.isAnimationMomentaryActive = isAnimationMomentaryActive;
if (isAnimationMomentaryActive) {
if (isAnimationMomentaryFinished) {
  this.animationMomentary = animationMomentary;
  this.animationMomentary.setPlayMode(Animation.NORMAL);
  this.isAnimationMomentaryActive = isAnimationMomentaryActive;

代码示例来源:origin: moribitotech/MTX

this.animationMomentary.setPlayMode(Animation.NORMAL);
this.isAnimationMomentaryActive = isAnimationMomentaryActive;
if (isAnimationMomentaryFinished) {
  this.animationMomentary = animationMomentary;
  this.animationMomentary.setPlayMode(Animation.NORMAL);
  this.isAnimationMomentaryActive = isAnimationMomentaryActive;

代码示例来源:origin: stackoverflow.com

playerRun.setPlayMode(Animation.PlayMode.LOOP);

代码示例来源:origin: net.mostlyoriginal.artemis-odb/contrib-jam

private static Animation<TextureRegion> asGdxAnimation(AseFormat ase, TextureRegion[] frames, int from, int to) {
  Animation<TextureRegion> animation = new Animation<>(
      ase.shortestFrameDuration() * ASESPRITE_TO_GDX_DURATION,
      framesAsAnimationArray(ase, frames, from, to, ase.frames));
  animation.setPlayMode(Animation.PlayMode.LOOP);
  return animation;
}

代码示例来源:origin: DaanVanYperen/artemis-odb-contrib

private static Animation<TextureRegion> asGdxAnimation(AseFormat ase, TextureRegion[] frames, int from, int to) {
  Animation<TextureRegion> animation = new Animation<>(
      ase.shortestFrameDuration() * ASESPRITE_TO_GDX_DURATION,
      framesAsAnimationArray(ase, frames, from, to, ase.frames));
  animation.setPlayMode(Animation.PlayMode.LOOP);
  return animation;
}

代码示例来源:origin: Var3D/var3dframe

/**
 * @param walkFrames (TextrueRegion数组)
 *                   (播放模式Animation.NORMAL, Animation.REVERSED, Animation.LOOP,
 *                   Animation.LOOP_REVERSED, Animation.LOOP_PINGPONG,
 *                   Animation.LOOP_RANDOM )
 *                   (帧速)
 */
public ActorAnimation(TextureRegion[] walkFrames) {
  setSize(walkFrames[0].getRegionWidth(), walkFrames[0].getRegionHeight());
  animation = new Animation(frameTime, (Object[]) walkFrames);
  animation.setPlayMode(playMode);
}

代码示例来源:origin: xietansheng/FlappyBirdForGDX

public BirdActor(MainGame mainGame) {
  super(mainGame);
  // 创建小鸟动画
  Animation animation = new Animation(
      0.2F,
      getMainGame().getAtlas().findRegions(Res.Atlas.IMAGE_BIRD_YELLOW_01_TO_03)
  );
  // 动画循环播放
  animation.setPlayMode(Animation.PlayMode.LOOP);
  // 设置小鸟动画
  setAnimation(animation);
  // 初始化为准备状态
  refreshFrameAndRotation(GameState.ready);
}

代码示例来源:origin: Var3D/var3dframe

public ActorAnimation(TextureRegion img, int numx, int numy, int max) {
  int tileWidth = (int) ((float) img.getRegionWidth() / numx);
  int tileHeight = (int) ((float) img.getRegionHeight() / numy);
  TextureRegion imgs[][] = img.split(tileWidth, tileHeight);
  TextureRegion walkFrames[] = new TextureRegion[max];
  for (int y = 0; y < numy; y++) {
    for (int x = 0; x < numx; x++) {
      int id = y * numx + x;
      if (id < max) {
        walkFrames[id] = imgs[y][x];
      }
    }
  }
  setSize(walkFrames[0].getRegionWidth(), walkFrames[0].getRegionHeight());
  animation = new Animation(frameTime, (Object[]) walkFrames);
  animation.setPlayMode(playMode);
}

代码示例来源:origin: dsaltares/ashley-superjumper

clickSound = Gdx.audio.newSound(Gdx.files.internal("data/click.wav"));
coinAnim.setPlayMode(PlayMode.LOOP);
bobJump.setPlayMode(PlayMode.LOOP);
bobFall.setPlayMode(PlayMode.LOOP);
bobHit.setPlayMode(PlayMode.LOOP);
squirrelFly.setPlayMode(PlayMode.LOOP);
platform.setPlayMode(PlayMode.LOOP);

相关文章