Andengine示例显示错误,无法工作。

7


我对andengine非常陌生,正在尝试使用来自git网址https://github.com/nicolasgramlich/AndEngineExamples的andengine示例。
但它总是向我显示两个类中的错误

BoundCameraExample和HullAlgorithmExample中的错误

在bound camera示例中,错误在第220行,显示:

类型不匹配:无法将void转换为AnimatedSprite

final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager()).animate(100);

在 HullAlgorithmExample 中,错误出现在 DrawMode 的导入语句上。 错误显示在第11行:import org.andengine.entity.primitive.vbo.DrawMode; 并且在第168行和175行中指出 DrawMode 无法解析为变量。
我正在使用 Java 编译器 1.6 来编译所有扩展程序。 我从同一 git 存储库中下载了 andengine 和扩展程序。 出了什么问题,请帮帮我。
谢谢大家。
2个回答

32

在BoundCameraExample中,尝试

final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion,  this.getVertexBufferObjectManager());
face.animate(100);

取而代之

final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion,  this.getVertexBufferObjectManager()).animate(100);

在HullAlgorithExample中,导入

import org.andengine.entity.primitive.DrawMode;

而不是

import org.andengine.entity.primitive.vbo.DrawMode;

1
我也遇到了同样的问题,阅读了所有与此问题相关的线程,但你让它变得更容易了。它正在工作。 - Ravikumar11

11

2014年,@swati-rawat的回答仍然有用。我发现了另外两个问题,我会在这里报告解决方案,因为这个问题排名很高:

SplitScreenExample中,就像在BoundCameraExample中一样,替换为:

final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager());
face.animate(100);

TextBreakExample 中替换为:

this.mText = new Text(50, 40, this.mFont, "", 1000, new TextOptions(AutoWrap.LETTERS, AUTOWRAP_WIDTH, HorizontalAlign.CENTER, Text.LEADING_DEFAULT), vertexBufferObjectManager);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接