1. 首先下載AndEngine 源碼 和 example和八個擴展,下載後,解壓。
2.講10個解壓包導入到eclipse(會有錯誤),
首先,將AndEngine 選擇項目--》 屬性,選擇java compiler,將右側的 compiler compliance level 改為 1.6 。
其次,針對AndEngine的八個擴展,同樣安裝上述方法,把compiler compliance level 改為1.6,然後分別導入剛才編譯好的 AndEngine的jar包。
最後,針對example,把compiler compliance level 改為1.6,導入剛才編譯好的AndEngine的jar包的同時,還要導入剛才編譯好的八個擴展的jar包。
做完以上步驟,仍會有些錯誤:
錯誤一:
Description Resource Path Location Type
Type mismatch: cannot convert from void to AnimatedSprite BoundCameraExample.java /AndEngineExamples/src/org/andengine/examples line 220 Java Problem
解決辦法:
[java]
final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager()).animate(100);
改為
[java]
final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager());
face.animate(100);
錯誤二:
Description Resource Path Location Type
The constructor TextOptions(AutoWrap, float, float, HorizontalAlign) is undefined TextBreakExample.java /AndEngineExamples/src/org/andengine/examples line 106 Java Problem
解決辦法:
[java]
this.mText = new Text(50, 40, this.mFont, "", 1000, new TextOptions(AutoWrap.LETTERS, AUTOWRAP_WIDTH, Text.LEADING_DEFAULT, HorizontalAlign.CENTER), vertexBufferObjectManager);
改為:
[java]
this.mText = new Text(50, 40, this.mFont, "", 1000, new TextOptions(AutoWrap.LETTERS, AUTOWRAP_WIDTH, HorizontalAlign.CENTER, Text.LEADING_DEFAULT), vertexBufferObjectManager);
錯誤三:
DrawMode cannot be resolved to a variable
解決辦法:
[java]
import org.andengine.entity.primitive.vbo.DrawMode;
改為:
[java]
import org.andengine.entity.primitive.DrawMode;