I
I
IgorMats2011-10-12 20:28:45
Android
IgorMats, 2011-10-12 20:28:45

AlphaModifier on click on sprite (Andengine)?

Hello dear!
I'm trying to program smooth scene switching on Andengine like in "Cut The Rope".
All my code works (with the Back button, for example) except for clicking on the sprite (button in the app).
I am using the following code:

AnimatedSprite Start = new AnimatedSprite(205, 440,
BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(ScreenTexture1, GameActivity.context,
              "gfx/image0001.png", 500, 0, 1, 2)) {
            @Override
            public boolean onAreaTouched(final TouchEvent pSceneTouchEvent,
                final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
                if(pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
                        this.nextTile();
                }
                if(pSceneTouchEvent.getAction() == TouchEvent.ACTION_UP) {
                        this.nextTile();
                        GameScenes.change(1);
                }
                 
                return true;
            }
                };

GameScenes.change(1); - This:
c = casper; // Это просто спрайт для AlphaModifier
                        new Thread() {
                                public void run() {
                                        c.registerEntityModifier(new AlphaModifier(3.2f, 1f, 0f));
                                }
                        }.run();
                        pause(3200);
                        return false;

When you click on the sprite, nothing happens, only the application falls asleep due to the sleep () function.
it seems to me that I got confused in the flows, they are so tricky there ...
What can you tell me in this situation? Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IgorMats, 2011-10-13
@IgorMats

Thank you all very much, I unexpectedly solved the problem using addModifierListener and onModifierFinished instead of sleeps and other nonsense.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question