本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.Animation.PlayMode类的典型用法代码示例。如果您正苦于以下问题:Java PlayMode类的具体用法?Java PlayMode怎么用?Java PlayMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayMode类属于com.badlogic.gdx.graphics.g2d.Animation包,在下文中一共展示了PlayMode类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WalkingGameObject
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode; //导入依赖的package包/类
public WalkingGameObject(TextureSheetAnimationInfo sheetInfo, long id, CollisionMap<GameObject> linkedCollisionMap)
{
super(Assets.get("nullTexture.png"), id, linkedCollisionMap);
Texture charactersTexture = sheetInfo.texture;
TextureRegion[][] charactersTextures = Sprite.split(charactersTexture,
charactersTexture.getWidth() / sheetInfo.textureTileWidth,
charactersTexture.getHeight() / sheetInfo.textureTileHeight);
TextureRegion[][] characterTextures = filter(charactersTextures, sheetInfo.textureTileXOffset,
sheetInfo.textureTileYOffset, sheetInfo.textureCountedTileWidth, sheetInfo.textureCountedTileHeight);
textureToDraw = characterTextures[0][0];
setSize(textureToDraw.getRegionWidth(), textureToDraw.getRegionHeight());
moveDownAnimation = new CustomAnimation<>(animationFrameDuration, characterTextures[0]);
moveLeftAnimation = new CustomAnimation<>(animationFrameDuration, characterTextures[1]);
moveRightAnimation = new CustomAnimation<>(animationFrameDuration, characterTextures[2]);
moveUpAnimation = new CustomAnimation<>(animationFrameDuration, characterTextures[3]);
moveUpAnimation.setPlayMode(PlayMode.LOOP);
moveLeftAnimation.setPlayMode(PlayMode.LOOP);
moveDownAnimation.setPlayMode(PlayMode.LOOP);
moveRightAnimation.setPlayMode(PlayMode.LOOP);
}
示例2: AnimatedSprite
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode; //导入依赖的package包/类
public AnimatedSprite(String key, float totalDuration, Integer numLoops, State state) {
super();
Array<AtlasRegion> frames = AssetManager.getInstance().getTextureRegions(key);
float frameDuration = ConversionUtils.ms2s(totalDuration / frames.size);
rawAnimation = new Animation(frameDuration, frames);
this.numLoops = numLoops;
if (numLoops == null || numLoops > 1) {
rawAnimation.setPlayMode(PlayMode.LOOP);
}
this.state = state;
setRegion(getCurrentFrame());
}
示例3: Laser
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode; //导入依赖的package包/类
public Laser(boolean bad) {
turnRed = bad;
sprite = new Sprite(Game.gfxMgr.getTexture("test", "laser2_strip4.png"));
sprite.setScale(0.25f, 7f);
tween = Game.twnMgr.createTween(BounceTween.class, TweenType.OUT, 0.5f, -0.5f, 4f);
TextureRegion[][] frames = TextureRegion.split(sprite.getTexture(), 16, 160);
TextureRegion[] give = new TextureRegion[4];
for(int i = 0; i < 4; i++) {
give[i] = frames[0][i];
}
anim = new Animation(1/16f, give);
anim.setPlayMode(PlayMode.LOOP);
sprite.setRegion(anim.getKeyFrame(time));
}
示例4: Background
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode; //导入依赖的package包/类
public Background(AssetManager manager) {
manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
manager.load(TEXTURE_FILENAME, Texture.class);
manager.finishLoading();
texture = manager.get(TEXTURE_FILENAME);
TextureRegion[] frames = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0];
animation = new Animation(0.1f, frames[0], frames[1], frames[2]);
animation.setPlayMode(PlayMode.LOOP);
setWidth(FRAME_WIDTH);
setHeight(FRAME_HEIGHT);
background = new TiledDrawable(animation.getKeyFrame(0f));
}
示例5: GigaGalAssets
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode; //导入依赖的package包/类
public GigaGalAssets(TextureAtlas atlas) {
standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);
jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);
Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);
Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
示例6: checkPrefs
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode; //导入依赖的package包/类
public void checkPrefs() {
isUnlocked = pref.getBoolean(characterName, false);
if (!isComingSoon)
if (isUnlocked)
if (lockDisplayed) {
name = assetManager.get(characterName + "Name.png", Texture.class);
description = assetManager.get(characterName + "Desc.png", Texture.class);
textureRegion = new TextureRegion(assetManager.get(characterName + "-j.png", Texture.class));
animatedTextures = textureRegion.split(18, 22)[0];
animation = new Animation(period, animatedTextures);
animation.setPlayMode(PlayMode.LOOP);
sprite = new Sprite(assetManager.get(characterName + ".png", Texture.class));
sprite.setScale(scale);
width = sprite.getWidth();
height = sprite.getHeight();
lockDisplayed = false;
}
}
示例7: Player
import com.badlogic.gdx.graphics.g2d.Animation.PlayMode; //导入依赖的package包/类
public Player(float x, float y, float health, AssetManager assetManager) {
super(x, y, health, assetManager);
bounds = new Rectangle[2];
bounds[0] = new Rectangle(-20, 0, 8, 8);
bounds[1] = new Rectangle(-20, 6, 18, 16);
pref = Gdx.app.getPreferences("com.subzero.runners");
defaultCharacter = pref.getString("defaultCharacter", "Nikola");
texture = assetManager.get(defaultCharacter + ".png", Texture.class);
textureRegion = new TextureRegion(assetManager.get(defaultCharacter + "-w.png", Texture.class));
animatedTextures = textureRegion.split(18, 22)[0];
animation = new Animation(period, animatedTextures);
animation.setPlayMode(PlayMode.LOOP);
textureRegion = new TextureRegion(assetManager.get(defaultCharacter + "-j.png", Texture.class));
animatedJumpTextures = textureRegion.split(18, 22)[0];
groundLevel = new Vector2(x, y);
sprite = new Sprite(texture, 18, 22);
sprite.setX(x);
sprite.setY(y);
}