我在设置子实体的Alpha值时遇到了困难。 我创建了一个矩形实体,并将一个文本实体附加到该矩形上,如下所示:
m_background = new Rectangle(0.0f, 0.0f, m_activity.getCamera().getWidth(), m_activity.getCamera().getHeight(), m_activity.getVertexBufferObjectManager());
m_background.setColor(0.0f, 0.0f, 0.0f);
FontFactory.setAssetBasePath("font/");
final ITexture fontTexture = new BitmapTextureAtlas(m_activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
this.m_Font = FontFactory.createFromAsset(m_activity.getFontManager(), fontTexture, m_activity.getAssets(), "Droid.ttf", 48, true, android.graphics.Color.WHITE);
this.m_Font.load();
Text text = new Text(100, 300, this.m_Font, "LoadingScreen", new TextOptions(HorizontalAlign.RIGHT), m_activity.getVertexBufferObjectManager());
m_background.attachChild(text);
现在我想将此背景实体的Alpha设置为0:
m_background.setAlpha(0.0f);
我原本以为子实体也会受到影响,但事实并非如此。除了直接在子实体上设置alpha之外,我该如何做呢?有更好的方法吗?
谢谢提前帮忙, Zerd