本文整理汇总了Java中org.andengine.entity.primitive.Rectangle.setZIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.setZIndex方法的具体用法?Java Rectangle.setZIndex怎么用?Java Rectangle.setZIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.entity.primitive.Rectangle
的用法示例。
在下文中一共展示了Rectangle.setZIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HealthBar
import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public HealthBar(Enemy parent, VertexBufferObjectManager pVertexBufferObjectManager) {
super(parent.mCenterX - (WIDTH + BORDER_THICKNESS * 2) / 2, parent.mCenterY - YOFFSET - BORDER_THICKNESS, WIDTH + BORDER_THICKNESS * 2, HEIGHT + BORDER_THICKNESS * 2, pVertexBufferObjectManager);
// set variables
mParent = parent;
setColor(0.3f, 0.3f, 0.3f);
setZIndex(800);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(this);
// set background
mHealthBackground = new Rectangle(mParent.mCenterX - WIDTH / 2, mParent.mCenterY - YOFFSET, WIDTH, HEIGHT, getVertexBufferObjectManager());
mHealthBackground.setColor(220f/255, 25f/255, 25f/255);
mHealthBackground.setZIndex(801);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(mHealthBackground);
// set foreground
mHealthForeground = new Rectangle(mParent.mCenterX - WIDTH / 2, mParent.mCenterY - YOFFSET, WIDTH, HEIGHT, getVertexBufferObjectManager());
mHealthForeground.setColor(100f/255, 220f/255, 20f/255);
mHealthForeground.setZIndex(802);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(mHealthForeground);
}
示例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);
}