• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PlayMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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);
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:22,代码来源:WalkingGameObject.java


示例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());
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:17,代码来源:AnimatedSprite.java


示例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));
}
 
开发者ID:pixelgriffin,项目名称:SPACEJUNK,代码行数:20,代码来源:Laser.java


示例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));
}
 
开发者ID:broken-shotgun,项目名称:throw-the-moon,代码行数:17,代码来源:Background.java


示例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);
}
 
开发者ID:udacity,项目名称:ud406,代码行数:24,代码来源:Assets.java


示例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;
			}

}
 
开发者ID:RyanMan56,项目名称:Runners,代码行数:23,代码来源:Podium.java


示例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);
}
 
开发者ID:RyanMan56,项目名称:Runners,代码行数:21,代码来源:Player.java



注:本文中的com.badlogic.gdx.graphics.g2d.Animation.PlayMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Target类代码示例发布时间:2022-05-21
下一篇:
Java TIntFloatMap类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap