当前位置: 首页>>代码示例>>Java>>正文


Java Group.setY方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.Group.setY方法的典型用法代码示例。如果您正苦于以下问题:Java Group.setY方法的具体用法?Java Group.setY怎么用?Java Group.setY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.Group的用法示例。


在下文中一共展示了Group.setY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setValues

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Override
public void setValues(Group target, int tweenType, float[] newValues) {
	switch (tweenType) {
	case POSITION:
		target.setPosition(newValues[0], newValues[1]);
		break;
	case ROTATION:
		target.setRotation(newValues[0]);
		break;
	case SCALE:
		target.setScale(newValues[0], newValues[1]);
		break;
	case X:
		target.setX(newValues[0]);
		break;
	case Y:
		target.setY(newValues[0]);
		break;
	case SCALE_X:
		target.setScaleX(newValues[0]);
		break;
	case SCALE_Y:
		target.setScaleY(newValues[0]);
		break;
	}
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:27,代码来源:GroupAccessor.java

示例2: processEntity

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Override
public void processEntity(Entity entity, float delta) {
	VelocityComponent velocity = entity
			.getComponent(VelocityComponent.class);
	PositionComponent positionComponent = entity
			.getComponent(PositionComponent.class);
	if (positionComponent == null) {
		positionComponent = gameLoop
				.createComponent(PositionComponent.class);
		positionComponent.set((EngineEntity) entity);
		entity.add(positionComponent);
	}

	Group actor = ((EngineEntity) entity).getGroup();

	positionComponent.incRealX(velocity.getX() * delta);
	positionComponent.incRealY(velocity.getY() * delta);

	actor.setX(positionComponent.getRealX());
	actor.setY(positionComponent.getRealY());
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:22,代码来源:VelocitySystem.java

示例3: makeCityScape

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
private void makeCityScape() {

		Group cityScape = new Group();

		Image cityScapeLeft = new Image(new TextureRegionDrawable(atlas2.findRegion("cityscape-left")), fit, Align.bottom);
		Image cityScapeRight = new Image(new TextureRegionDrawable(atlas2.findRegion("cityscape-right")), fit, Align.bottom);
		Image cityScapeMiddle = new Image(TowerAssetManager.drawable("backgrounds/cityscape-middle.png"), stretchX, Align.bottom);
		cityScapeLeft.setWidth((int) Math.min(getStage().getWidth() * 0.33f, cityScapeLeft.getImageWidth()));
		cityScapeLeft.setHeight((int) Math.min(getStage().getHeight() * 0.33f, cityScapeLeft.getImageHeight()));
		cityScapeLeft.pack();

		cityScapeRight.setWidth((int) Math.min(getStage().getWidth() * 0.33f, cityScapeRight.getImageWidth()));
		cityScapeRight.setHeight((int) Math.min(getStage().getHeight() * 0.33f, cityScapeRight.getImageHeight()));
		cityScapeRight.pack();

		cityScapeRight.setX(getStage().getWidth() - cityScapeRight.getWidth());

		cityScapeMiddle.setWidth((int) getStage().getWidth() * 0.33f);
		cityScapeMiddle.setHeight((int) getStage().getHeight() * 0.33f);
		cityScapeMiddle.setX((int) cityScapeLeft.getWidth());
		cityScapeMiddle.setWidth((int) getStage().getWidth() - cityScapeLeft.getWidth() - cityScapeRight.getWidth());

		cityScape.addActor(cityScapeLeft);
		cityScape.addActor(cityScapeMiddle);
		cityScape.addActor(cityScapeRight);

		container.addActor(cityScape);

		cityScape.setY(-getStage().getHeight());
		Tween.to(cityScape, WidgetAccessor.POSITION, CAMERA_PAN_DOWN_DURATION).delay(50).target(cityScape.getX(), 0)
				.ease(TweenEquations.easeInOutExpo).start(TweenSystem.manager());
	}
 
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:33,代码来源:SplashScene.java

示例4: execute

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Override
public void execute(Entity target, ChangeParent effect) {
	if (!(target instanceof EngineEntity)) {
		Gdx.app.debug(CHANGE_PARENT_EXECUTOR,
				"Can't execute effect - target is not of type EngineEntity");
		return;
	}

	Object value = variablesManager.evaluateExpression(effect
			.getNewParent());
	EngineEntity newParent = null;
	if (value instanceof EngineEntity) {
		newParent = (EngineEntity) value;
	} else if (value instanceof Array) {
		Array array = (Array) value;
		if (array.size > 0 && array.get(0) instanceof EngineEntity) {
			newParent = (EngineEntity) array.get(0);
		}
	}

	if (newParent == null) {
		Gdx.app.debug(CHANGE_PARENT_EXECUTOR,
				"Can't execute effect - new parent is not of type EngineEntity");
		return;
	}

	EngineEntity child = (EngineEntity) target;
	Group childGroup = child.getGroup();
	Vector2 stageOrigin = new Vector2(childGroup.getX(), childGroup.getY());
	stageOrigin = childGroup.localToStageCoordinates(stageOrigin);
	childGroup.remove();
	newParent.getGroup().addActor(childGroup);
	Vector2 newLocalCoordinates = childGroup
			.stageToLocalCoordinates(stageOrigin);
	childGroup.setX(newLocalCoordinates.x);
	childGroup.setY(newLocalCoordinates.y);
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:38,代码来源:ChangeParentExecutor.java


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