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

Java MoveByAction类代码示例

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

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.actions.MoveByAction的典型用法代码示例。如果您正苦于以下问题:Java MoveByAction类的具体用法?Java MoveByAction怎么用?Java MoveByAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MoveByAction类属于com.badlogic.gdx.scenes.scene2d.actions包,在下文中一共展示了MoveByAction类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: move

import com.badlogic.gdx.scenes.scene2d.actions.MoveByAction; //导入依赖的package包/类
public void move(int x, int y) {
    float size = 32.0f;
    // Distance in pixels
    float dx = size * x;
    float dy = size * y;

    int destX = getPosX() + x;
    int destY = getPosY() + y;

    MoveByAction moveX = new MoveByAction();
    moveX.setAmountX(dx);
    moveX.setDuration(Math.abs(x) * 0.1f);

    MoveByAction moveY = new MoveByAction();
    moveY.setAmountY(dy);
    moveY.setDuration(Math.abs(y) * 0.1f);

    moveSeq = new SequenceAction(moveX, moveY);
    Speech.getInstance().speak("move " + this.name + " to " + getLetter(destY) + " " + (destX + 1));

    this.setPosition(destY, destX);
    this.addAction(moveSeq);

    moved = true;
    GameState.getInstance().addMove();
}
 
开发者ID:DiamondFire,项目名称:DIamondFire,代码行数:27,代码来源:Knight.java


示例2: actionMoveBy

import com.badlogic.gdx.scenes.scene2d.actions.MoveByAction; //导入依赖的package包/类
/**
 * Action move by.
 *
 * @param x the x
 * @param y the y
 * @param duration the duration
 */
public void actionMoveBy(float x, float y, float duration) {
	// Move towards a direction during given time (NON-STOP)
	MoveByAction action = new MoveByAction();
	action.setAmount(x, y);
	if (duration > 0) {
		action.setDuration(duration);
	}
	addAction(action);
}
 
开发者ID:sawankh,项目名称:MathAttack,代码行数:17,代码来源:AbstractActorLight.java


示例3: isPlayerMoving

import com.badlogic.gdx.scenes.scene2d.actions.MoveByAction; //导入依赖的package包/类
/**
 * Prüft, ob der übergebene Player sich bewegt anhand des Vorhandenseins
 * einer MoveByAction.
 * 
 * @param player
 *            Der Spieler
 * @return true wenn der Player sich bewegt, sonst false
 */
protected static boolean isPlayerMoving(final Player player) {
	Array<Action> actions = player.getActions();

	for (Action action : actions) {
		if (action instanceof MoveByAction) {
			return true;
		}
	}

	return false;
}
 
开发者ID:PhilippGrulich,项目名称:HAW-SE2-projecthorse,代码行数:20,代码来源:WorldMapUtils.java


示例4: movePlayer

import com.badlogic.gdx.scenes.scene2d.actions.MoveByAction; //导入依赖的package包/类
/**
 * Bewegt den Player von seiner aktuellen Position in einer flüssigen
 * Animation auf geradem Weg zur einer anderen Stadt.
 * 
 * @param city
 *            Die Ziel Stadt.
 */
private void movePlayer(final String city) {
	int[] cityCoordinates = cityInfos.get(city);

	Vector2 source = new Vector2(player.getX() + player.getWidth() / 2
			* player.getScaleX(), player.getY());
	Vector2 target = new Vector2(cityCoordinates[0], cityCoordinates[1]);

	Direction animationDirection = WorldMapUtils.getDirection(source,
			target);
	AnimationAction animationRun = new AnimationAction(animationDirection,
			PLAYERSPEED);

	// Weggelassen, da alleine schon die Existens einer Idle AnimationAction
	// während der Abarbeitung einer anderen AnimationAction
	// stand 14.12.14 zum Fehler führt
	// AnimationAction animationIdle = new
	// AnimationAction(WorldMapUtils.getIdleDirection(animationDirection));
	// SequenceAction animationSequence = new SequenceAction(animationRun,
	// animationIdle);

	MoveByAction movement = new MoveByAction();
	movement.setAmount(target.x - source.x, target.y - source.y);
	movement.setDuration(PLAYERSPEED);

	player.clearActions();
	player.setAnimationSpeed(1 - PLAYERSPEED / 2.5f);
	player.addAction(movement);
	// player.addAction(animationSequence);
	player.addAction(animationRun);

}
 
开发者ID:PhilippGrulich,项目名称:HAW-SE2-projecthorse,代码行数:39,代码来源:WorldMap.java


示例5: Pipe

import com.badlogic.gdx.scenes.scene2d.actions.MoveByAction; //导入依赖的package包/类
public Pipe(TextureRegion region, Stage stage, Droid droid, boolean countPipe, OnScoreListener listener) {
    super(region);

    mAndy = droid;
    mStage = stage;

    mCountPipe = countPipe;
    mListener = listener;

    MoveByAction moveLeft = new MoveByAction();
    moveLeft.setDuration(FlopsyScreen.SPEED);
    moveLeft.setAmountX(-Ground.GROUND_WIDTH);
    addAction(Actions.forever(moveLeft));
}
 
开发者ID:mauimauer,项目名称:flopsydroid,代码行数:15,代码来源:Pipe.java


示例6: playDeathAnimation

import com.badlogic.gdx.scenes.scene2d.actions.MoveByAction; //导入依赖的package包/类
public void playDeathAnimation() {
	float x = 50;
	if(playerActor.getDirection()) {
		x = -x;
	}
	MoveByAction moveUp = Actions.moveBy(x, 0, 0.1f + 0.002f*playerActor.getY());
	moveUp.setInterpolation(Interpolation.circleOut);

	MoveByAction moveDown = Actions.moveBy(0,-(playerActor.getY() + playerActor.getWidth()), 0.1f+0.002f*playerActor.getY());
	moveDown.setInterpolation(Interpolation.swingIn);
	Action deathAction = Actions.parallel(moveUp,moveDown);
	playerActor.addAction(deathAction);

}
 
开发者ID:dieubware,项目名称:Escape-of-the-Ninja,代码行数:15,代码来源:GameScreen.java


示例7: move

import com.badlogic.gdx.scenes.scene2d.actions.MoveByAction; //导入依赖的package包/类
private static MoveByAction move(Actor actor, float targetX, float targetY) {
	return Actions.moveBy(targetX - actor.getX(), targetY - actor.getY(),
			HIDE_TIME, Interpolation.exp5Out);
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:5,代码来源:BaseView.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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