Thursday, March 24, 2011

AndEngine from Scratch (III)

Previously on AndEngine from Scratch



Today's Goals


We have two objetives today:

  • Splash Screen for the game
  • Create the grass background


Splash Screen


Every game deserves a decent splash screen. Let's see how can we create a nice one. AndEngine has a BaseSPlashActivity. Go to Eclipse, in the package explorer, under src/com.pruebas.andengine and create a new class.



Name SplashExample and in SuperClass we must search for BaseSplashActivity.




There is the result.


  1. package com.pruebas.andengine;
  2.  
  3. import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
  4. import org.anddev.andengine.opengl.texture.source.ITextureSource;
  5. import org.anddev.andengine.ui.activity.BaseSplashActivity;
  6.  
  7. import android.app.Activity;
  8.  
  9. public class SplashExample extends BaseSplashActivity {
  10.  
  11. @Override
  12. //Ojo, porque esto no se ve bien aqui, dejadlo como Eclipse lo genera
  13. protected Class<? extends Activity> getFollowUpActivity() {
  14. // TODO Auto-generated method stub
  15. return null;
  16. }
  17.  
  18. @Override
  19. protected ScreenOrientation getScreenOrientation() {
  20. // TODO Auto-generated method stub
  21. return null;
  22. }
  23.  
  24. @Override
  25. protected float getSplashDuration() {
  26. // TODO Auto-generated method stub
  27. return 0;
  28. }
  29.  
  30. @Override
  31. protected ITextureSource onGetSplashTextureSource() {
  32. // TODO Auto-generated method stub
  33. return null;
  34. }
  35.  
  36. }
Parsed in 0.074 seconds at 11.94 KB/s, using GeSHi 1.0.8.10


Now let's touch some methods of the clase to show the splash screen we want. If you dont have a decent image, you can download this one. Remember save it as assets/gfx/splash.png.




Now touch the class SplashExample.java to show the splash from that file. Let's define some constants.


  1. // ===========================================================
  2. // Constants
  3. // ===========================================================
  4.  
  5. private static final int SPLASH_DURATION = 3;
  6. private static final float SPLASH_SCALE_FROM = 1f;
Parsed in 0.074 seconds at 3.24 KB/s, using GeSHi 1.0.8.10

SPLASH_DURATION Defines the time in seconds for the splash, three second is fine. The second constant defines the scale that the initial bitmap, try putting 0.5f and the image will make a animation.

In the first method getFollowUpActivity() we must return the Main activity of the game.


  1. @Override
  2. protected Class<? extends Activity> getFollowUpActivity() {
  3. return Main.class;
  4. }
Parsed in 0.080 seconds at 1.19 KB/s, using GeSHi 1.0.8.10

The second method is getScreenOrientation(), we are working in LANDSCAPE.


  1. protected ScreenOrientation getScreenOrientation() {
  2. return ScreenOrientation.LANDSCAPE;
  3. }
Parsed in 0.082 seconds at 1.15 KB/s, using GeSHi 1.0.8.10

Third mehotd getSplashDuration(), we return the constant.


  1. @Override
  2. protected float getSplashDuration() {
  3. return SPLASH_DURATION;
  4. }
Parsed in 0.077 seconds at 1.01 KB/s, using GeSHi 1.0.8.10

And finally onGetSplashTextureSource(), we return the bitmap previously saved in assets/gfx.



  1. protected ITextureSource onGetSplashTextureSource() {
  2. return new AssetTextureSource(this, "gfx/splash.png");
  3. }
  4.  
Parsed in 0.076 seconds at 1.51 KB/s, using GeSHi 1.0.8.10

Now Let's implement a new method for the zoom an play some with it.


  1. protected float getSplashScaleFrom() {
  2. return SPLASH_SCALE_FROM;
  3. }
Parsed in 0.077 seconds at 1.06 KB/s, using GeSHi 1.0.8.10

We have now the SplashExample class, now let's put it in the AndroidManifest.xml and make it the default activiy.


  1. <activity android:name="SplashExample"
  2.                   android:label="@string/app_name">
  3. <intent-filter>
  4. <action android:name="android.intent.action.MAIN" />
  5. <category android:name="android.intent.category.LAUNCHER" />
  6. </intent-filter>
  7. </activity>
Parsed in 0.004 seconds at 87.19 KB/s, using GeSHi 1.0.8.10


We need to remove the intent-filter for the main activity. F11 to start the game and we can see the splash screen running.


Background Grass


To create the backgound seems to be several options. First i tried with a RepeatingSpriteBackground, but it doesn't scrool with the screen. Let's try with a TMXLoader, loading the level from a xml file.


Thankfully there is a free open source level editor available for most platforms. The first is to create a sprite with the grass background. There it is. Save it to assets/gfx as ussual.



The way to create levels is based on tiled pngs. In our case we need four borders, left, right, top, bottom and a center one. Nine tiles.



There is the png with visible borders to you can make an idea of how it works. Nine tiles of 120X120. Now we mus get the level editor (tiled). In debian is as simple as "sudo apt-get install tiled". In other linux you probably have this software in the package manager of the distribution. In windows you can download the software from the web.
Caution: After install, go to Edit->Preferences and in "Store Tile layer data as" -> "Base64 gzip compressed". If you dont do that, AndEngine will crash when you try to load the tmx file.


After a funny time, i get the tmx file. Now let's add to the project. Under the assets folder we create a folder named "tmx". Here we must put our maps. Mine looks like this:

  1. <map version="1.0" orientation="orthogonal" width="4" height="8" tilewidth="120" tileheight="120">
  2. <tileset firstgid="1" name="background" tilewidth="120" tileheight="120">
  3. <image source="gfx/background_tile.png"/>
  4. </tileset>
  5. <layer name="Capa de Patrones 1" width="4" height="8">
  6. <data encoding="base64" compression="gzip">
  7. H4sIAAAAAAAAA2NlYGBghGI2IGYBYk4oZqYBnx2ImaCYA4gB8HAreoAAAAA=
  8. </data>
  9. </layer>
  10. </map>
Parsed in 0.006 seconds at 69.25 KB/s, using GeSHi 1.0.8.10

Look carefully at image-source, this point to gfx/background_tile.png, if you edit the map in tiled, you must count with that.

Before we put some code, i have Main.java like this:

  1. package com.pruebas.andengine;
  2.  
  3. import org.anddev.andengine.engine.Engine;
  4. import org.anddev.andengine.engine.camera.ZoomCamera;
  5. import org.anddev.andengine.engine.options.EngineOptions;
  6. import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
  7. import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
  8. import org.anddev.andengine.entity.scene.Scene;
  9. import org.anddev.andengine.entity.scene.Scene.IOnSceneTouchListener;
  10. import org.anddev.andengine.entity.scene.background.ColorBackground;
  11. import org.anddev.andengine.entity.sprite.Sprite;
  12. import org.anddev.andengine.entity.util.FPSLogger;
  13. import org.anddev.andengine.input.touch.TouchEvent;
  14. import org.anddev.andengine.input.touch.detector.ScrollDetector;
  15. import org.anddev.andengine.input.touch.detector.SurfaceScrollDetector;
  16. import org.anddev.andengine.input.touch.detector.ScrollDetector.IScrollDetectorListener;
  17. import org.anddev.andengine.opengl.texture.Texture;
  18. import org.anddev.andengine.opengl.texture.TextureOptions;
  19. import org.anddev.andengine.opengl.texture.region.TextureRegion;
  20. import org.anddev.andengine.opengl.texture.region.TextureRegionFactory;
  21. import org.anddev.andengine.ui.activity.BaseGameActivity;
  22.  
  23. import android.util.Log;
  24.  
  25. public class Main extends BaseGameActivity implements IScrollDetectorListener,
  26. IOnSceneTouchListener {
  27. // ===========================================================
  28. // Constants
  29. // ===========================================================
  30. static final int CAMERA_WIDTH = 480;
  31. static final int CAMERA_HEIGHT = 320;
  32.  
  33. private static final String TAG = "AndEngineTest";
  34.  
  35. // ===========================================================
  36. // Fields
  37. // ===========================================================
  38.  
  39. private ZoomCamera mCamera;
  40. private Texture mTexture;
  41. private TextureRegion mFaceTextureRegion;
  42. private SurfaceScrollDetector mScrollDetector;
  43.  
  44. // ===========================================================
  45. // Constructors
  46. // ===========================================================
  47.  
  48. // ===========================================================
  49. // Getter & Setter
  50. // ===========================================================
  51.  
  52. // ===========================================================
  53. // Methods for/from SuperClass/Interfaces
  54. // ===========================================================
  55.  
  56. @Override
  57. public void onLoadComplete() {
  58. // TODO Auto-generated method stub
  59.  
  60. }
  61.  
  62. @Override
  63. public Engine onLoadEngine() {
  64. this.mCamera = new ZoomCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
  65. final int alturaTotal = CAMERA_HEIGHT * 3;
  66. this.mCamera.setBounds(0, CAMERA_WIDTH, 0, alturaTotal);
  67. this.mCamera.setBoundsEnabled(true);
  68. return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,
  69. new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
  70. this.mCamera));
  71. }
  72.  
  73. @Override
  74. public void onLoadResources() {
  75. this.mTexture = new Texture(64, 64,
  76. TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  77. this.mFaceTextureRegion = TextureRegionFactory.createFromAsset(
  78. this.mTexture, this, "gfx/ui_ball_1.png", 0, 0);
  79.  
  80. this.mEngine.getTextureManager().loadTexture(this.mTexture);
  81.  
  82. }
  83.  
  84. @Override
  85. public Scene onLoadScene() {
  86. this.mEngine.registerUpdateHandler(new FPSLogger());
  87.  
  88. final Scene scene = new Scene(1);
  89. scene.setBackground(new ColorBackground(0, 0, 0.8784f));
  90. scene.setOnAreaTouchTraversalFrontToBack();
  91.  
  92. this.mScrollDetector = new SurfaceScrollDetector(this);
  93. this.mScrollDetector.setEnabled(true);
  94.  
  95. final int centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
  96. final int centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion
  97. .getHeight()) / 2;
  98.  
  99. final Sprite ball = new Sprite(centerX, centerY,
  100. this.mFaceTextureRegion);
  101. scene.getLastChild().attachChild(ball);
  102.  
  103. scene.setOnSceneTouchListener(this);
  104. scene.setTouchAreaBindingEnabled(true);
  105.  
  106. return scene;
  107. }
  108.  
  109. @Override
  110. public void onScroll(ScrollDetector pScollDetector, TouchEvent pTouchEvent,
  111. float pDistanceX, float pDistanceY) {
  112. this.mCamera.offsetCenter(-pDistanceX, -pDistanceY);
  113. }
  114.  
  115. @Override
  116. public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
  117. this.mScrollDetector.onTouchEvent(pSceneTouchEvent);
  118. return true;
  119. }
  120.  
  121. // ===========================================================
  122. // Methods
  123. // ===========================================================
  124.  
  125. // ===========================================================
  126. // Inner and Anonymous Classes
  127. // ===========================================================
  128. }
  129.  
Parsed in 0.106 seconds at 43.53 KB/s, using GeSHi 1.0.8.10

Vamos a crear una variable para el TMXTiledMap.

private TMXTiledMap mTMXTiledMap;

In the onLoadScene() method when we set the background color with

scene.setBackground(new ColorBackground(0, 0, 0.8784f));

Change the code with this one

  1. final Scene scene = new Scene(1);
  2.  
  3. try {
  4. final TMXLoader tmxLoader = new TMXLoader(this, this.mEngine
  5. .getTextureManager(), TextureOptions.NEAREST);
  6. this.mTMXTiledMap = tmxLoader.loadFromAsset(this, "tmx/field.tmx");
  7. } catch (final TMXLoadException tmxle) {
  8. Debug.e(tmxle);
  9. }
  10.  
  11. final TMXLayer tmxLayer = this.mTMXTiledMap.getTMXLayers().get(0);
  12. scene.getFirstChild().attachChild(tmxLayer);
Parsed in 0.088 seconds at 4.74 KB/s, using GeSHi 1.0.8.10

Now we can try the background, F11 to see how it looks... Good, isn't it? It have a little problem with the terminal i'm trying on. When i do the vertical scroll a little black lines appears in some circunstances between the tiles. A little investigation in the AndEngine forums and see the solution. Let's go to the source, when we create the background texture, and change TextureOptions.BILINEAR_PREMULTIPLYALPHA to TextureOptions.NEAREST. Then we go to the method onLoadEngine() and put some code in the camera creation to round the camera coordinates to integer.


  1. this.mCamera = new ZoomCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT) {
  2.  
  3. @Override
  4. public void onApplyMatrix(GL10 pGL) {
  5. GLHelper.setProjectionIdentityMatrix(pGL);
  6.  
  7. GLU.gluOrtho2D(pGL, (int) this.getMinX(), (int) this.getMaxX(),
  8. (int) this.getMaxY(), (int) this.getMinY());
  9. }
  10. };
Parsed in 0.091 seconds at 3.29 KB/s, using GeSHi 1.0.8.10

Perfect!! Problem solved. Now we have the code working well... there is my Main.java.


Main.java
  1. package com.pruebas.andengine;
  2.  
  3. import org.anddev.andengine.engine.Engine;
  4. import org.anddev.andengine.engine.camera.ZoomCamera;
  5. import org.anddev.andengine.engine.options.EngineOptions;
  6. import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
  7. import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
  8. import org.anddev.andengine.entity.layer.tiled.tmx.TMXLayer;
  9. import org.anddev.andengine.entity.layer.tiled.tmx.TMXLoader;
  10. import org.anddev.andengine.entity.layer.tiled.tmx.TMXTiledMap;
  11. import org.anddev.andengine.entity.layer.tiled.tmx.util.exception.TMXLoadException;
  12. import org.anddev.andengine.entity.scene.Scene;
  13. import org.anddev.andengine.entity.scene.Scene.IOnSceneTouchListener;
  14. import org.anddev.andengine.entity.sprite.Sprite;
  15. import org.anddev.andengine.entity.util.FPSLogger;
  16. import org.anddev.andengine.input.touch.TouchEvent;
  17. import org.anddev.andengine.input.touch.detector.ScrollDetector;
  18. import org.anddev.andengine.input.touch.detector.SurfaceScrollDetector;
  19. import org.anddev.andengine.input.touch.detector.ScrollDetector.IScrollDetectorListener;
  20. import org.anddev.andengine.opengl.texture.Texture;
  21. import org.anddev.andengine.opengl.texture.TextureOptions;
  22. import org.anddev.andengine.opengl.texture.region.TextureRegion;
  23. import org.anddev.andengine.opengl.texture.region.TextureRegionFactory;
  24. import org.anddev.andengine.ui.activity.BaseGameActivity;
  25. import org.anddev.andengine.util.Debug;
  26.  
  27. public class Main extends BaseGameActivity implements IScrollDetectorListener,
  28.  
  29. IOnSceneTouchListener {
  30. // ===========================================================
  31. // Constants
  32. // ===========================================================
  33. static final int CAMERA_WIDTH = 480;
  34. static final int CAMERA_HEIGHT = 320;
  35. private static final String TAG = "AndEngineTest";
  36. // ===========================================================
  37. // Fields
  38. // ===========================================================
  39. private ZoomCamera mCamera;
  40. private Texture mTexture;
  41. private TextureRegion mFaceTextureRegion;
  42. private SurfaceScrollDetector mScrollDetector;
  43. private TMXTiledMap mTMXTiledMap;
  44.  
  45. // ===========================================================
  46. // Constructors
  47. // ===========================================================
  48. // ===========================================================
  49. // Getter & Setter
  50. // ===========================================================
  51. // ===========================================================
  52. // Methods for/from SuperClass/Interfaces
  53. // ===========================================================
  54. @Override
  55. public void onLoadComplete() {
  56. // TODO Auto-generated method stub
  57. }
  58.  
  59. @Override
  60. public Engine onLoadEngine() {
  61. this.mCamera = new ZoomCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
  62. final int alturaTotal = CAMERA_HEIGHT * 3;
  63. this.mCamera.setBounds(0, CAMERA_WIDTH, 0, alturaTotal);
  64. this.mCamera.setBoundsEnabled(true);
  65. return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,
  66. new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
  67. this.mCamera));
  68. }
  69.  
  70. @Override
  71. public void onLoadResources() {
  72. this.mTexture = new Texture(64, 64,
  73. TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  74. this.mFaceTextureRegion = TextureRegionFactory.createFromAsset(
  75. this.mTexture, this, "gfx/ui_ball_1.png", 0, 0);
  76. this.mEngine.getTextureManager().loadTexture(this.mTexture);
  77. }
  78.  
  79. @Override
  80. public Scene onLoadScene() {
  81. this.mEngine.registerUpdateHandler(new FPSLogger());
  82. final Scene scene = new Scene(1);
  83. try {
  84. final TMXLoader tmxLoader = new TMXLoader(this, this.mEngine
  85. .getTextureManager(), // TextureOptions.BILINEAR_PREMULTIPLYALPHA,
  86. TextureOptions.NEAREST);
  87. this.mTMXTiledMap = tmxLoader.loadFromAsset(this, "tmx/field.tmx");
  88. } catch (final TMXLoadException tmxle) {
  89. Debug.e(tmxle);
  90. }
  91. final TMXLayer tmxLayer = this.mTMXTiledMap.getTMXLayers().get(0);
  92.  
  93. scene.getFirstChild().attachChild(tmxLayer);
  94. scene.setOnAreaTouchTraversalFrontToBack();
  95.  
  96. this.mScrollDetector = new SurfaceScrollDetector(this);
  97. this.mScrollDetector.setEnabled(true);
  98.  
  99. final int centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
  100. final int centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion
  101. .getHeight()) / 2;
  102. final Sprite ball = new Sprite(centerX, centerY,
  103. this.mFaceTextureRegion);
  104. scene.getLastChild().attachChild(ball);
  105. scene.setOnSceneTouchListener(this);
  106. scene.setTouchAreaBindingEnabled(true);
  107.  
  108. return scene;
  109. }
  110.  
  111. @Override
  112. public void onScroll(ScrollDetector pScollDetector, TouchEvent pTouchEvent,
  113. float pDistanceX, float pDistanceY) {
  114. this.mCamera.offsetCenter(-pDistanceX, -pDistanceY);
  115. }
  116.  
  117. @Override
  118. public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
  119. this.mScrollDetector.onTouchEvent(pSceneTouchEvent);
  120. return true;
  121. }
  122. // ===========================================================
  123. // Methods
  124. // ===========================================================
  125. // ===========================================================
  126. // Inner and Anonymous Classes
  127. // ===========================================================
  128. }
Parsed in 0.154 seconds at 33.72 KB/s, using GeSHi 1.0.8.10

Well, enough for today. In the next chapter we are gonna implement our own Detector, like the IScrollDetector we see in the previous chapter, but to archery games.


Source Code

To get the source code: svn checkout http://ch-soccer.googlecode.com/svn/trunk/ tutorial-read-only -r 6


Index

19 comments:

  1. I get the splash screen perfectly but I'm losing you, it seems, the further along we get. I finished this tutorial and have my code just like yours I think and keep getting a force close from the emulator. I haven't messed with the emu too much so not sure what I could have done to it or not done to it so this will work...

    I get as far as the splash screen animating and scaling largerand then after about 5 seconds and thenn boom! ..."force close".

    sad face
    Any ides??

    Thanks!

    ReplyDelete
  2. Thanks for the comment.

    I'm trying to start the project from cero, upload the sources to google code and make instructions at the end of every chapter to download tested sources.

    I'm new with subversion and need a little researching... look in the next week.

    In the debug perspective in the debug window you must see some information about the error, if you email me the error i will try to solve it.

    ReplyDelete
  3. Same thing here, force close after splash screen. After stepping trough with debuger I noticed that android is trying to find a MainGame class but without success.

    ReplyDelete
  4. Try downloading the sources from the subversion repository:

    svn checkout http://ch-soccer.googlecode.com/svn/trunk/ tutorial-read-only -r 6

    Is tested working on the emulator.

    Thank you for the feedback.

    ReplyDelete
  5. For the force close problem, ensure you have BOTH activities in your AndroidManifest.xml file. The SplashExample does not replace the Main activity. For example:
    <activity android:name="SplashExample" android:label="@string/app_name">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    <activity android:name="Main" android:label="@string/app_name"></activity>

    ReplyDelete
  6. Okay I was able to get the Tile program to work and produce a .tmx file but what did you call it. This is what is causing the force close I'm pretty sure because it is crashing on the tmx file because I couldn't really follow you on those steps. What should be the contents of the 'tmx' folder?

    I did make the changes to my code to be exactly like that in the link posted above. I did have the manifest file wrong but it still force closes because of a general unknown andengine package error.

    Thanks again!

    ReplyDelete
  7. Had a force close too. I had to change my tmx file. Try my suggestion maybe it will help you too.
    - Open tmx file with notepad
    - Change the path of background_tile.png file from "../gfx/" to "gfx/".

    ReplyDelete
  8. @TommyAngelo

    Thank you; that solved it for me.

    Unfortunately, I have to add the ../ to the path again in order to edit the .tmx file with Tiled, then take it out to compile in Eclipse... but now we can move forward! Thanks!

    ReplyDelete
  9. Nice Tutorial!
    Things that I did to work.

    1. Copy & paste your field.tmx code into mine, maybe I mess with something in Tiled.

    2. About "onApplyMatrix()", work only without that step, if I override it, I got a black screen.

    ReplyDelete
  10. Ok, now I know how to play with Tiled :P
    Everything Ok.

    About onApplyMatrix(), I'm using the linux AVD emulator with a 1.6 api.

    ReplyDelete
  11. could only see the grass using your tmx file. My tmx file generated on OSX gave a slightly different data string. It was base64 gzip, but did background ended up completely black. Only difference in the tmx file was the data which was this:

    H4sIAAAAAAAAA2NgGFgAAJ36qMKAAAAA

    Maybe I missed some option in tiled on OSX ...

    ReplyDelete
  12. ah, worked it out. I actually have to draw the pitch myself in tiled ...

    ReplyDelete
  13. Note, in the current AndEngine I found this code causes a NPE:

    final TMXLayer tmxLayer = this.mTMXTiledMap.getTMXLayers().get(0);
    scene.getLastChild().attachChild(tmxLayer); // NPE Here

    It seems, that until you add at least one child, getLastChild now returns null. Replace it with the following:
    scene.attachChild(tmxLayer);

    The subsequent call to getLastChild().attachChild(ball) will work because you have added the tmx layer as the first child...

    ReplyDelete
  14. I'm stuck at how to use tiled to make a tmx file.

    Can you post details on how to do that step?

    ReplyDelete
  15. hello
    plz tell me how to create tmx file and how to make maps which we used in tmx folder...I am completely lost after making splash...plz help soon
    thanks in advance

    ReplyDelete
  16. Open Tiled, click File -> New Map, I used 'orthogonal', width-4, height-8, click OK.

    Click Edit -> Preferences. Change first box to Base64 (gzip compressed), click OK.

    Click Map -> New tileset, find the background_tile.png, set tile width and height, click OK. Tiled will slice up the image into 120 by 120 tiles. You can now click a tile and click on the main window to draw the map.

    Save the file, put into your tmx folder inside assets. Open tmx file in notepad, check the link to background_tile.png to make sure 'gfx' is referenced. Run the tutorial and you're good to go.

    ReplyDelete
  17. @murphy - thanks for clearing that up!

    ReplyDelete
  18. If you compile the new andengine.jar from https://andengine.googlecode.com/hg/ andengine ?

    Replace existing code with this code in the SplashExample.class

    @Override
    protected IBitmapTextureAtlasSource onGetSplashTextureAtlasSource() {
    // OLD: return new AssetTextureSource(this, "gfx/splash.png");
    return new AssetBitmapTextureAtlasSource(this, "gfx/splash.png");
    }

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete