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


Java Rectangle.setVisible方法代码示例

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


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

示例1: defineRectangularHitbox

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
 * Set the hitbox relatively to the Sprite
 * 
 * @param xmin left distance to the sprite
 * @param ymin top distance to the sprite
 * @param width width of the hitbox
 * @param height height of the hitbox
 * @return this so this call can be inline
 */
public SpriteComponent defineRectangularHitbox(float xmin, float ymin, float width, float height) {
	//sprite.setColor(Color.RED);
	hitbox = new Rectangle(xmin, ymin, width, height, sprite.getVertexBufferObjectManager());
	
	if (GameActivity.DEBUG_MODE) {
		hitbox.setVisible(true); // to set to false
		hitbox.setAlpha(10); // DON'T WORK
		hitbox.setColor(Color.BLUE);
	} else {
		hitbox.setVisible(false);
	}
	
	sprite.attachChild(hitbox);
	return this;
}
 
开发者ID:Callilf,项目名称:RotatingSentries,代码行数:25,代码来源:SpriteComponent.java

示例2: initInfoMessageText

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
 * 戦闘ログテキスト初期化
 */
private void initInfoMessageText(IEntity entity) {
	float width = getBaseScene().getWindowWidth() - (getBaseScene().getWindowWidth() / 10);
	float height = 40;
	Rectangle rectangle = getBaseScene().createRectangle(0, 0, width, height);
	rectangle.setColor(Color.BLACK);
	rectangle.setAlpha(0.5f);
	rectangle.setZIndex(LayerZIndexType.TEXT_LAYER.getValue());
	rectangle.setTag(INFO_MESSAGE_TEXT_TAG);
	
	Text text = new Text(10, 10, getBaseScene().createFont(Typeface.DEFAULT, 20, Color.WHITE), 
			"000000000000000000000000000000000000000000000000000000000000000", 
			getBaseScene().getBaseActivity().getVertexBufferObjectManager());
	rectangle.attachChild(text);

	getBaseScene().placeToCenterX(rectangle, 10);
	rectangle.setVisible(false);
	
	entity.attachChild(rectangle);
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:23,代码来源:BattlePart.java

示例3: createWorldBoundaries

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/** Create three walls (left, ground, right) as the field's boundaries (open at the top) */
private void createWorldBoundaries() {
	Body body;
	final Rectangle wall_ground = new Rectangle(GameScreen.FIELD_WIDTH/2, FIELD_BASELINE_Y-WALL_THICKNESS/2, GameScreen.FIELD_WIDTH, WALL_THICKNESS, mVertexManager);
	final Rectangle wall_left = new Rectangle(GOAL_WIDTH-WALL_THICKNESS/2, GameScreen.FIELD_HEIGHT*2, WALL_THICKNESS, GameScreen.FIELD_HEIGHT*4, mVertexManager); // make left and right wall 4x-high so that the ball can never cross these walls
	final Rectangle wall_right = new Rectangle(GameScreen.FIELD_WIDTH-GOAL_WIDTH+WALL_THICKNESS/2, GameScreen.FIELD_HEIGHT*2, WALL_THICKNESS, GameScreen.FIELD_HEIGHT*4, mVertexManager); // make left and right wall 4x-high so that the ball can never cross these walls

	body = PhysicsFactory.createBoxBody(mPhysicsWorld, wall_ground, BodyType.StaticBody, ObjectFixtures.getWall());
	body.setUserData(BODY_TYPE_WALL_GROUND); // set the identifier for this body (e.g. for collision detection later)
	wall_ground.setVisible(false); // walls are not visible
	wall_ground.setUserData(body); // attach the body (shape) to the wall

	body = PhysicsFactory.createBoxBody(mPhysicsWorld, wall_left, BodyType.StaticBody, ObjectFixtures.getWall());
	body.setUserData(BODY_TYPE_WALL_LEFT); // set the identifier for this body (e.g. for collision detection later)
	wall_left.setVisible(false); // walls are not visible
	wall_left.setUserData(body); // attach the body (shape) to the wall

	body = PhysicsFactory.createBoxBody(mPhysicsWorld, wall_right, BodyType.StaticBody, ObjectFixtures.getWall());
	body.setUserData(BODY_TYPE_WALL_RIGHT); // set the identifier for this body (e.g. for collision detection later)
	wall_right.setVisible(false); // walls are not visible
	wall_right.setUserData(body); // attach the body (shape) to the wall

	attachChild(wall_ground); // attach the wall to the scene
	attachChild(wall_left); // attach the wall to the scene
	attachChild(wall_right); // attach the wall to the scene
}
 
开发者ID:delight-im,项目名称:NationSoccer,代码行数:27,代码来源:GameScene.java

示例4: hideBattleMenuLayer

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
private void hideBattleMenuLayer() {
	Rectangle battleMenu = (Rectangle) mBaseLayer.getChildByTag(BATTLE_MENU_TAG);
	if (battleMenu != null) {
		battleMenu.setVisible(false);
		battleMenu.setPosition(getBaseScene().getWindowWidth() * 4, 
				getBaseScene().getWindowHeight() * 4);
	}
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:9,代码来源:BattlePart.java

示例5: showInfoMessageText

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
private void showInfoMessageText(String message) {
	final Rectangle infoMessageRect = (Rectangle) mBaseLayer.getChildByTag(INFO_MESSAGE_TEXT_TAG);
	((Text)infoMessageRect.getChildByIndex(0)).setText(message);
	infoMessageRect.setVisible(true);
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:6,代码来源:BattlePart.java


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