Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to solve logcat in Particle Effect
    primarykey
    data
    text
    <p>I am trying to add particle effect in my game. No error but showing logcat when running. Below is my code and logcat.</p> <pre><code>@Override public void onLoadResources() { //prepare a container for particle mParticleBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR_PREMULTIPLYALPHA); // setting assets path for easy access BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); mParticleTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mParticleBitmapTextureAtlas, this, "particle_fire.png", 0,0); // loading textures in the engine mEngine.getTextureManager().loadTexture(this.mParticleBitmapTextureAtlas); } @Override public Scene onLoadScene() { mEngine.registerUpdateHandler(new FPSLogger()); mMainScene = new Scene(); mMainScene.setBackground(new ColorBackground(0f, 0f, 0f)); //particle system /* Left to right Particle System. */ { final ParticleSystem particleSystem = new ParticleSystem(new PointParticleEmitter(0, CAMERA_HEIGHT), 6, 10, 70, this.mParticleTextureRegion); particleSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE); particleSystem.addParticleInitializer(new VelocityInitializer(15, 22, -60, -90)); particleSystem.addParticleInitializer(new AccelerationInitializer(5, 15)); particleSystem.addParticleInitializer(new RotationInitializer(0.0f, 360.0f)); particleSystem.addParticleInitializer(new ColorInitializer(1.0f, 0.0f, 0.0f)); particleSystem.addParticleModifier(new ScaleModifier(0.5f, 2.0f, 0, 5)); particleSystem.addParticleModifier(new ExpireModifier(11.5f)); particleSystem.addParticleModifier(new AlphaModifier(1.0f, 0.0f, 2.5f, 3.5f)); particleSystem.addParticleModifier(new AlphaModifier(0.0f, 1.0f, 3.5f, 4.5f)); particleSystem.addParticleModifier(new ColorModifier(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 11.5f)); particleSystem.addParticleModifier(new AlphaModifier(1.0f, 0.0f, 4.5f, 11.5f)); this.mMainScene.getLastChild().attachChild(particleSystem); } return mMainScene; } </code></pre> <p>////////////////////logcat///////////////////////</p> <pre><code> 06-11 18:51:59.588: E/AndroidRuntime(1539): FATAL EXCEPTION: main 06-11 18:51:59.588: E/AndroidRuntime(1539): java.lang.NullPointerException 06-11 18:51:59.588: E/AndroidRuntime(1539): at com.example.AndEngineTest.AndEngineTest.onLoadScene(AndEngineTest.java:251) 06-11 18:51:59.588: E/AndroidRuntime(1539): at org.anddev.andengine.ui.activity.BaseGameActivity.doResume(BaseGameActivity.java:169) 06-11 18:51:59.588: E/AndroidRuntime(1539): at org.anddev.andengine.ui.activity.BaseGameActivity.onWindowFocusChanged(BaseGameActivity.java:85) 06-11 18:51:59.588: E/AndroidRuntime(1539): at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:2366) 06-11 18:51:59.588: E/AndroidRuntime(1539): at android.view.View.dispatchWindowFocusChanged(View.java:5735) 06-11 18:51:59.588: E/AndroidRuntime(1539): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:851) 06-11 18:51:59.588: E/AndroidRuntime(1539): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2557) 06-11 18:51:59.588: E/AndroidRuntime(1539): at android.os.Handler.dispatchMessage(Handler.java:99) 06-11 18:51:59.588: E/AndroidRuntime(1539): at android.os.Looper.loop(Looper.java:137) 06-11 18:51:59.588: E/AndroidRuntime(1539): at android.app.ActivityThread.main(ActivityThread.java:4424) 06-11 18:51:59.588: E/AndroidRuntime(1539): at java.lang.reflect.Method.invokeNative(Native Method) 06-11 18:51:59.588: E/AndroidRuntime(1539): at java.lang.reflect.Method.invoke(Method.java:511) 06-11 18:51:59.588: E/AndroidRuntime(1539): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 06-11 18:51:59.588: E/AndroidRuntime(1539): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 06-11 18:51:59.588: E/AndroidRuntime(1539): at dalvik.system.NativeStart.main(Native Method) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload