I am new to Android game development. I am using AndEngine GLES-2. I have created a box with a sprite. This box is now draggable by using the code below. It works fine.

But I want multi-touch on this: I want to rotate the sprite with two fingers on that box, and to keep it draggable.

I've no idea how do do that, which way should I go?

final float centerX = (CAMERA_WIDTH - this.mBox.getWidth()) / 2;
final float centerY = (CAMERA_HEIGHT - this.mBox.getHeight()) / 2;

Box = new Sprite(centerX, centerY, this.mBox, this.getVertexBufferObjectManager()) {

    public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {

        this.setPosition(pSceneTouchEvent.getX() - this.getWidth()/ 2, pSceneTouchEvent.getY() - this.getHeight() / 2);

        float pValueX = pSceneTouchEvent.getX();
        float pValueY = CAMERA_HEIGHT-pSceneTouchEvent.getY();

        float  dx = pValueX -  gun.getX();
        float  dy = pValueY -  gun.getY();

        double  Radius = Math.atan2(dy,dx);
        double Angle = Radius * 360 ;

        return true;

1 Answer 1


As far has I know the engine doesn't support it, but the multi-touch extension does support dragging of entities.

I think you could attach two invisible entities to your box, enable multitouch drag on them and try to adjust the angle of your box respectively with the x,y position of both of the boxes.

That's surely not the easiest solution, but I think it's feasible.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .