[TUTORIAL] Getting Started with AndEngine

  ... tutorials on how to use AndEngine.

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby jano_alex_es » Sat Oct 08, 2011 11:36 pm

Hi, I solved the problem I told you about (in other thread). Solved it reinstalling everything again... who knows.

I would like to ask you about how to start a new project from zero. For example, I'm trying to do the JiMMaR's tutorial (http://www.andengine.org/forums/tutorials/simple-andengine-game-t5145.html) and I'm having about 500 errors.

Step by step:

- Crete new Androidproject
- Extends from BaseGameActivity
- Link source->AndEngine src folder
- Write some initial code.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.game_test;
  2.  
  3. import org.anddev.andengine.engine.Engine;
  4. import org.anddev.andengine.engine.camera.Camera;
  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.background.ColorBackground;
  10. import org.anddev.andengine.entity.util.FPSLogger;
  11. import org.anddev.andengine.ui.activity.BaseGameActivity;
  12.  
  13. import android.os.Bundle;
  14. import android.view.Display;
  15.  
  16.  
  17.  
  18. public class Game_tutorialActivity extends BaseGameActivity {
  19.         private Camera mCamera;
  20.         private Scene mMainScene;
  21.  
  22.         public Engine onLoadEngine() {
  23.  
  24.                 final Display display = getWindowManager().getDefaultDisplay();
  25.                 int cameraWidth = display.getWidth();
  26.                 int cameraHeight = display.getHeight();
  27.  
  28.                 mCamera = new Camera(0, 0, cameraWidth, cameraHeight);
  29.  
  30.                 return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,
  31.                 new RatioResolutionPolicy(cameraWidth, cameraHeight), mCamera));
  32.         }
  33.        
  34.         public Scene onLoadScene() {
  35.                 mEngine.registerUpdateHandler(new FPSLogger());
  36.  
  37.                 mMainScene = new Scene();
  38.                 mMainScene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));
  39.                 return mMainScene;
  40.         }
  41.        
  42.     /** Called when the activity is first created. */
  43.     @Override
  44.     public void onCreate(Bundle savedInstanceState) {
  45.         super.onCreate(savedInstanceState);
  46.         setContentView(R.layout.main);
  47.     }
  48.  
  49.         @Override
  50.         public void onLoadResources() {
  51.                 // TODO Auto-generated method stub
  52.                
  53.         }
  54.  
  55.         @Override
  56.         public void onLoadComplete() {
  57.                 // TODO Auto-generated method stub
  58.                
  59.         }
Parsed in 0.015 seconds, using GeSHi 1.0.8.4



And try to execute it. Some of the errors are:



Description Resource Path Location Type
ArrayUtils cannot be resolved SocketServerDiscoveryServer.java /AndEngineMultiplayerExtension/src/org/anddev/andengine/extension/multiplayer/protocol/server line 176 Java Problem
BaseDetector cannot be resolved to a type PinchZoomDetector.java /AndEngineMultiTouchExtension/src/org/anddev/andengine/extension/input/touch/detector line 18 Java Problem
BaseGameActivity cannot be resolved to a type BaseAugmentedRealityGameActivity.java /AndEngineAugmentedRealityExtension/src/org/anddev/andengine/extension/augmentedreality line 19 Java Problem
BaseGameActivity cannot be resolved to a type BaseAugmentedRealityGameActivity.java /AndEngineAugmentedRealityExtension/src/org/anddev/andengine/extension/augmentedreality line 36 Java Problem
BaseGameActivity cannot be resolved to a type BaseAugmentedRealityGameActivity.java /AndEngineAugmentedRealityExtension/src/org/anddev/andengine/extension/augmentedreality line 66 Java Problem
BaseTouchController cannot be resolved to a type MultiTouchController.java /AndEngineMultiTouchExtension/src/org/anddev/andengine/extension/input/touch/controller line 15 Java Problem
BitmapTexture cannot be resolved to a type TexturePackParser.java /AndEngineTexturePackerExtension/src/org/anddev/andengine/extension/texturepacker/opengl/texture/util/texturepacker line 155 Java Problem
BitmapTextureAtlas cannot be resolved to a type SVGBitmapTextureAtlasTextureRegionFactory.java /AndEngineSVGTextureRegionExtension/src/org/anddev/andengine/extension/svg/opengl/texture/atlas/bitmap line 96 Java Problem



Seems like I'm missing a lot of "linking" stuff... but I don't find where can I have the problem.

do you know what can be missing? I think in the tutorial works fine because linking the lib file solves all this possible linking problems.

thanks!
jano_alex_es
 
Posts: 4
Joined: Wed Oct 05, 2011 12:22 am

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby jano_alex_es » Sun Oct 09, 2011 11:19 am

Hi again.

Seems like this method does not work with 1.5 and 1.6 Android versions. All the errors and problems appear if you are coding in a 1.6 project. Just copying and pasting the code in a 2.2 version makes it work.

I don't know if you already knew and I haven't notice. I should pay more attention...
jano_alex_es
 
Posts: 4
Joined: Wed Oct 05, 2011 12:22 am

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby Spacemanifestation » Mon Oct 10, 2011 2:48 am

jano_alex_es wrote:Hi, I solved the problem I told you about (in other thread). Solved it reinstalling everything again... who knows.

I would like to ask you about how to start a new project from zero. For example, I'm trying to do the JiMMaR's tutorial (http://www.andengine.org/forums/tutorials/simple-andengine-game-t5145.html) and I'm having about 500 errors.

Step by step:

- Crete new Androidproject
- Extends from BaseGameActivity
- Link source->AndEngine src folder
- Write some initial code.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.game_test;
  2.  
  3. import org.anddev.andengine.engine.Engine;
  4. import org.anddev.andengine.engine.camera.Camera;
  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.background.ColorBackground;
  10. import org.anddev.andengine.entity.util.FPSLogger;
  11. import org.anddev.andengine.ui.activity.BaseGameActivity;
  12.  
  13. import android.os.Bundle;
  14. import android.view.Display;
  15.  
  16.  
  17.  
  18. public class Game_tutorialActivity extends BaseGameActivity {
  19.         private Camera mCamera;
  20.         private Scene mMainScene;
  21.  
  22.         public Engine onLoadEngine() {
  23.  
  24.                 final Display display = getWindowManager().getDefaultDisplay();
  25.                 int cameraWidth = display.getWidth();
  26.                 int cameraHeight = display.getHeight();
  27.  
  28.                 mCamera = new Camera(0, 0, cameraWidth, cameraHeight);
  29.  
  30.                 return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,
  31.                 new RatioResolutionPolicy(cameraWidth, cameraHeight), mCamera));
  32.         }
  33.        
  34.         public Scene onLoadScene() {
  35.                 mEngine.registerUpdateHandler(new FPSLogger());
  36.  
  37.                 mMainScene = new Scene();
  38.                 mMainScene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));
  39.                 return mMainScene;
  40.         }
  41.        
  42.     /** Called when the activity is first created. */
  43.     @Override
  44.     public void onCreate(Bundle savedInstanceState) {
  45.         super.onCreate(savedInstanceState);
  46.         setContentView(R.layout.main);
  47.     }
  48.  
  49.         @Override
  50.         public void onLoadResources() {
  51.                 // TODO Auto-generated method stub
  52.                
  53.         }
  54.  
  55.         @Override
  56.         public void onLoadComplete() {
  57.                 // TODO Auto-generated method stub
  58.                
  59.         }
Parsed in 0.016 seconds, using GeSHi 1.0.8.4



And try to execute it. Some of the errors are:



Description Resource Path Location Type
ArrayUtils cannot be resolved SocketServerDiscoveryServer.java /AndEngineMultiplayerExtension/src/org/anddev/andengine/extension/multiplayer/protocol/server line 176 Java Problem
BaseDetector cannot be resolved to a type PinchZoomDetector.java /AndEngineMultiTouchExtension/src/org/anddev/andengine/extension/input/touch/detector line 18 Java Problem
BaseGameActivity cannot be resolved to a type BaseAugmentedRealityGameActivity.java /AndEngineAugmentedRealityExtension/src/org/anddev/andengine/extension/augmentedreality line 19 Java Problem
BaseGameActivity cannot be resolved to a type BaseAugmentedRealityGameActivity.java /AndEngineAugmentedRealityExtension/src/org/anddev/andengine/extension/augmentedreality line 36 Java Problem
BaseGameActivity cannot be resolved to a type BaseAugmentedRealityGameActivity.java /AndEngineAugmentedRealityExtension/src/org/anddev/andengine/extension/augmentedreality line 66 Java Problem
BaseTouchController cannot be resolved to a type MultiTouchController.java /AndEngineMultiTouchExtension/src/org/anddev/andengine/extension/input/touch/controller line 15 Java Problem
BitmapTexture cannot be resolved to a type TexturePackParser.java /AndEngineTexturePackerExtension/src/org/anddev/andengine/extension/texturepacker/opengl/texture/util/texturepacker line 155 Java Problem
BitmapTextureAtlas cannot be resolved to a type SVGBitmapTextureAtlasTextureRegionFactory.java /AndEngineSVGTextureRegionExtension/src/org/anddev/andengine/extension/svg/opengl/texture/atlas/bitmap line 96 Java Problem



Seems like I'm missing a lot of "linking" stuff... but I don't find where can I have the problem.

do you know what can be missing? I think in the tutorial works fine because linking the lib file solves all this possible linking problems.

thanks!


Hello there.
Just remove the following code from your app and it should work fine :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.    
  2. /** Called when the activity is first created. */
  3.     @Override
  4.     public void onCreate(Bundle savedInstanceState) {
  5.         super.onCreate(savedInstanceState);
  6.         setContentView(R.layout.main);
  7.     }
  8.  
Parsed in 0.015 seconds, using GeSHi 1.0.8.4


Though BaseGameActivity extends Activity,I don't think there should be an onCreate method in your app. If you still have errors,try upgrading your AndEngine jar file.
Thanks.
Spacemanifestation
 
Posts: 16
Joined: Sat Oct 08, 2011 5:36 am

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby Giszmo » Wed Oct 12, 2011 2:56 am

Hi Mayo,

I linked this thread in my fork of AndEngineExamples. Hopefully we can extend the code and the wiki to a state it is usable again. To me it is not at this moment. Please contribute at
https://bitbucket.org/giszmo/andenginee ... /wiki/Home

You can edit the wiki directly. You can fork the project and do pull requests if you know how to fix those zillions of bugs there are now.

Regards,

Leo Wandersleb
FluxCards allows you to learn 20 words per day with only 15 minutes repeating per day. Try it out. It's free and amazing ;)
Image Image
Giszmo
 
Posts: 113
Joined: Thu Mar 03, 2011 11:07 pm

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby Giszmo » Wed Oct 12, 2011 3:36 am

09-13 16:56:54.813: ERROR/AndroidRuntime(276): java.lang.StackOverflowError
09-13 16:56:54.813: ERROR/AndroidRuntime(276): at org.anddev.andengine.ui.activity.BaseGameActivity.getFontManager(BaseGameActivity.java:137)


https://bitbucket.org/giszmo/andengine/ ... ivity.java
Nicolas changed getA() { b.getA(); } to getA() {this.getA();}. I just wonder why this could happen a month ago without getting fixed. The rest of this commit is long to read but a trivial rename.
I have no clue of how open the development is, but I will try to maintain a clean repository with such fixes and do pull requests.
FluxCards allows you to learn 20 words per day with only 15 minutes repeating per day. Try it out. It's free and amazing ;)
Image Image
Giszmo
 
Posts: 113
Joined: Thu Mar 03, 2011 11:07 pm

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby tmcthree » Mon Oct 24, 2011 4:52 pm

Nicolas Gramlich wrote:Very nice, the only thing I didn't understand was why you didn't keep the extensions as library projects but manually linked the source folders.


Hi Nicholas, could you possibly expand on what you mean by this and what the advantages might be, for a newb like me?
tmcthree
 
Posts: 337
Joined: Mon Aug 08, 2011 8:21 pm

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby tmcthree » Mon Oct 24, 2011 5:00 pm

RealMayo wrote:Thanks guys!
The reason I didn't keep the extensions as library projects was two fold:
1) I was experiencing errors when trying to run the AndEngine Examples. I probably overlooked some very simple fix, but in the end this method is what worked for me.
2) The method I used (I feel) is more straightforward when the user creates a brand new project for themselves.

Nevertheless, I'm always open to constructive feedback. Although I doubt I'll want to go through the pain of re-recording any of those videos ;)

Anyway, do you think we might want to "sticky" this thread?
Thanks


Hey RealMayo, thanks very much for taking the time to do this, very helpful indeed. Can I just ask a quick question. When we now create our own projects, within that workspace, what stages should we follow. I take it we can just "link source" the extensions to the new project.

And when we create a new workspace, should we download using mercurial again or just copy from the other workspace, or indeed is it good practice to always use that workspace when making andengine games?

Sorry that was more than one question, I got a bit carried away.
tmcthree
 
Posts: 337
Joined: Mon Aug 08, 2011 8:21 pm

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby RealMayo » Mon Oct 24, 2011 5:06 pm

tmcthree wrote:Hey RealMayo, thanks very much for taking the time to do this, very helpful indeed. Can I just ask a quick question. When we now create our own projects, within that workspace, what stages should we follow.


Hi there,
Just watch my 3rd video and it will walk you through the steps for creating your own project ;)
User avatar
RealMayo
 
Posts: 1694
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby Halollet » Sat Oct 29, 2011 10:02 pm

Great videos but I'm not even through the first one and I'm getting errors

[2011-10-29 14:11:07 - AndEngine] Unable to resolve target 'android-8'
[2011-10-29 14:14:54 - AndEnginePhysicsBox2DExtension] Unable to resolve target 'android-8'
[2011-10-29 14:15:45 - AndEngineTexturePackerExtension] Unable to resolve target 'android-8'
[2011-10-29 14:16:56 - AndEngineSVGTextureRegionExtension] Unable to resolve target 'android-8'
[2011-10-29 14:17:46 - AndEngineMultiTouchExtension] Unable to resolve target 'android-8'
[2011-10-29 14:18:27 - AndEngineMultiplayerExtension] Unable to resolve target 'android-8'

Did I miss something?
Halollet
 
Posts: 13
Joined: Sun Jul 10, 2011 8:55 pm
Location: Ontario, Canada

Re: [TUTORIAL] UPDATED - Getting Started with AndEngine

Postby RealMayo » Wed Nov 02, 2011 3:57 pm

Halollet wrote:Great videos but I'm not even through the first one and I'm getting errors
[2011-10-29 14:11:07 - AndEngine] Unable to resolve target 'android-8'

I know that Halollet already resolved this problem, but just in case anybody else is wondering... I believe this issue occurs when the user neglects to choose the Android 2.2 API 8 option when installing the Android SDK.
User avatar
RealMayo
 
Posts: 1694
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

PreviousNext

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 8 guests