1. Introduction to andengine
Andengine is an android game engine developed by a foreign Daniel. Currently, Android open-source game engines with a large amount of online materials include Rokon (unfortunately, the original author has stopped updating due to academic and other tasks, and there are many bugs), libgdx (lack of documentation) lgame (self-developed by Chinese people), alien3d, and andengine (the original author is still updating, with support from foreign communities, and technical books are available for reference). As a personal research on Android game development, the blogger chose andengine to start learning.
The original author of andengine put it open-source on GitHub. There are currently many different branches. In addition, andengine has two major versions with its supported OpenGL ES versions, as a result, the current version and materials are chaotic. Most of the existing materials and some books on the Internet are old versions, this article and subsequent articles are based on gles2 (different versions of andengine may need different extension packages and sample programs.
II. Introduction to common extensions of andengine
The andengine version used in this article is the AndEngine-GLES2. : Https://github.com/nicolasgramlich/AndEngine
Andenginetmxtiledmapextension for tile map extension,: https://github.com/nicolasgramlich/AndEngineTMXTiledMapExtension
Andenginetexturepackerextension is a Sprite table Extension: https://github.com/nicolasgramlich/AndEngineTexturePackerExtension
Andenginesvgtextureregionextension is an SVG texture extension: https://github.com/nicolasgramlich/AndEngineSVGTextureRegionExtension
Andenginescriptingextensiongenerator is the script extension generator,: https://github.com/nicolasgramlich/AndEngineScriptingExtensionGenerator
Andenginescriptingextension is a script Extension: https://github.com/nicolasgramlich/AndEngineScriptingExtension
Andenginerobotiumextension is a robotium Extension: https://github.com/nicolasgramlich/AndEngineRobotiumExtension
Andenginephysicsbox2dextension is a physical engine Extension: https://github.com/nicolasgramlich/AndEnginePhysicsBox2DExtension
Andenginemultitouchextension for multi-touch extension,: https://github.com/nicolasgramlich/AndEngineMultiTouchExtension
Andenginemultiplayerextension for multiple players,: https://github.com/nicolasgramlich/AndEngineMultiplayerExtension
Andenginemodplayerextension is a mod Extension: https://github.com/nicolasgramlich/AndEngineMODPlayerExtension
Andenginelivewallpaperextension for live wallpaper extensions,: https://github.com/nicolasgramlich/AndEngineLiveWallpaperExtension
Andengineaugmentedrealityextension for augmented reality extensions: https://github.com/nicolasgramlich/AndEngineAugmentedRealityExtension
3. Set up the andengine sample Environment
1. Build an android development environment. This article does not introduce it. You can Google it on your own.
2. Download the corresponding version of The andengine sample package,: https://github.com/nicolasgramlich/AndEngineExamples
3. decompress the sample package, click Import in the development environment, click Import to import an existing Android project, select the sample project, and import it.
4. Download and compile the andengine project package.
5. Download the above 12 extension packages, reference the jar files generated in step 1, and compile them.
6. Reference 13 jar files generated in steps 4th and 5th in the sample project.
7. Compile the program. Several errors can be found at the moment. Modify as follows.
In the org. andengine. Examples. hullalgorithmexample. Java file
import org.andengine.entity.primitive.vbo.Mesh;
Change
import org.andengine.entity.primitive.Mesh;
In the org. andengine. Examples. textbreakexample. Java file
this.mText = new Text(50, 40, this.mFont, "", 1000, new TextOptions(AutoWrap.LETTERS, AUTOWRAP_WIDTH, Text.LEADING_DEFAULT, HorizontalAlign.CENTER), vertexBufferObjectManager);
Change
this.mText = new Text(50, 40, this.mFont, "", 1000, new TextOptions(AutoWrap.LETTERS, Text.LEADING_DEFAULT, HorizontalAlign.CENTER), vertexBufferObjectManager);
In the org. andengine. Examples. boundcameraexample. Java file and org. andengine. Examples. splitscreenexample. Java file
final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager()).animate(100);
Change
final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager()); face.animate(100);
8. after completing the preceding steps, recompile and some examples of physical engines cannot be run. You need to download libandenginephysicsbox2dextension. so file. Create the \ libs \ armeabi directory under the example project directory and place the file under it (because some devices do not support physical engine extension packages well, you need to directly call the compiled so file), re-compile the entire sample project, and run most of the examples in the android simulator or real machine environment.
Note: The Administrator uses the real machine environment for debugging. The Android system version is 2.3 and the memory is 512 MB.