Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8019519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:24:38+00:00 2026-06-04T21:24:38+00:00

I am making a game for Android using AndEngine. Right now I’m trying to

  • 0

I am making a game for Android using AndEngine. Right now I’m trying to figure out how to make explosion sprites appear on the scene and then be removed X seconds after. Here is my explosion class:

public class Explosion extends Sprite {

    public Explosion(float pX, float pY, ITextureRegion pTextureRegion, VertexBufferObjectManager pVertexBufferObjectManager) {
        super(pX, pY, pTextureRegion, pVertexBufferObjectManager);
    }
}

Now what I want to do to this class to make it different from a regular Sprite object is for it to appear, then be destroyed after a certain amount of time. How do I accomplish this using the AndEngine?

EDIT: If it’s possible to pull this off without having to create a custom Explosion class extending Sprite then I would prefer to do it that way since it would be neater.

Also note that there will be multiple explosions on screen at once being created at different times so I want each explosion to have their own individual lifespans.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:24:39+00:00Added an answer on June 4, 2026 at 9:24 pm

    There are several techniques you could use depending on your needs. If you explosion is animated, I’d just use an AnimatedSprite with an IAnimationListener to trap when the animation changes frames and/or is finished and then remove the explosion sprite.

    Or, you could use a DelayModifier – I use one of these to “dissolve a rock”

    Or, you could use just about any other Modifier – like a moving Modifier like say a QuadraticBezierCurveMoveModifier, or a Modifer like an AlphaModifier.

    Regardless of the Modifier used, you attach a IEntityModifierListener() and in the onModifierFinished do your clean up of your explosion.

    The following code uses that technique to “fade” a score off the game board

    gemScore.registerEntityModifier(new AlphaModifier(2f, 1f, 0f, new IEntityModifierListener() {
    
            @Override
            public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
                // TODO Auto-generated method stub
                runOnUpdateThread(new Runnable() {
    
                    @Override
                    public void run() {
                        // TODO Auto-generated method stub
                        board.detachChild(gemScore);
                    }
                });
            }
        }));
    

    HTH

    Here is an example of the DelayModifier – same basic structure

    mainScene.registerEntityModifier(new DelayModifier(3, new IEntityModifierListener() {
    
            @Override
            public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
                // TODO Auto-generated method stub
                runOnUpdateThread(new Runnable() {
                    @Override
                    public void run() {
                        // TODO Auto-generated method stub
                        mainScene.detachChild(sign);
                    }
                });
            }
        }));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am making a game using andengine in android, in this game various sprites(eggs)
So in an android game (using andEngine) I'm making, I'm trying to save a
For a 2D game I'm making (for Android) I'm using a component-based system where
I am making a game for Android and using Rails for server coding, and
I am making game for android using libgdx my requirement is that when character
I'm trying to make an NDK-based game work on Android ICS. It worked fine
I'm trying to make an Android game, and I am following a few code
I'm making my first game using Java on Android. I need to draw a
I'm making a game for Android and I'm using transparent PNG's. But does the
I am new to android development, making a simple game and using onKeyDown(.....) function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.