Question

I'm using AndEngine multi-touch functions to create multi-sprite for my game. But I've a problem:

  • When I create the sprite (in the Scene touch down event), I call its StartGrowSize method.
  • When user stops touching (release his/her finger) at a sprite, I need call its StopGrowSize method.

The problem is, I CAN'T determine when the user releases her finger, and which finger (the finger that create that sprite).

This is some code in my game:

@Override
public boolean onSceneTouchEvent(Scene arg0, TouchEvent arg1) {
    if (arg1.isActionDown()) {
        //Create a balloon
        int balloonType = rndGenerator.nextInt(GlobalStatic.BalloonTypeTotal);
        currentBalloon = new clsBalloon(arg1.getX(), arg1.getY(), 
            ANDBallonTextureRegion[balloonType].clone(), balloonType, this);
        balloons.add(currentBalloon);

        scnGameScene.ettBalloon.attachChild(currentBalloon);
    } 
    return true;
}

In the clsBalloon:

    @Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
        float pTouchAreaLocalX, float pTouchAreaLocalY) {
    if (pSceneTouchEvent.isActionUp()) {
        StopGrowSize();
        return true;
    }
    return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
}

But it didn't work. Please help me, thank you.

Was it helpful?

Solution

OK, so now my solution is that create a pre-sprite that fill the screen and register its touch handler, resize and set its new face.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top