在 AndEngine 中从场景中删除对象

发布于 2024-12-16 21:40:20 字数 68 浏览 2 评论 0原文

我在 andEngine 中有一个场景。该场景基本上包含三个动画对象。我想添加和删除意味着在屏幕上显示和隐藏。这怎么可能?

I have a scene in andEngine. The scene has basically three animated objects. I want to add and remove means show and hide on the screen. Hows that possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉城已无爱 2024-12-23 21:40:21

请记住,我没有 Android 手机,也从未使用过此 API。

我认为您需要在场景图中添加和删除精灵:

示例代码:

scene.detachChild(childSpriteVariable);

示例代码:

final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion);
scene.attachChild(face);

我基本上得到了这个通过浏览本网站获取信息。这似乎是该引擎唯一的官方文档:

http://code.google.com/p/ andengineexamples/

Keep in mind that I don't own an Android phone, and I have never used this API.

I think you'd need to add and remove sprites to the scene-graph:

Example code:

scene.detachChild(childSpriteVariable);

Example code:

final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion);
scene.attachChild(face);

I'm basically getting this information by browsing this site. It seems to be the only official docs this engine has:

http://code.google.com/p/andengineexamples/

献世佛 2024-12-23 21:40:21

要从场景中删除对象:(在本例中是 Sprite 对象,但您可以删除任何实体)

 scene.getTopLayer().removeEntity(sprite);

要隐藏场景:

scene.back();

To remove an object from a scene: (in this case a Sprite object but you can remove any entity)

 scene.getTopLayer().removeEntity(sprite);

To hide a scene:

scene.back();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文