1

I'm using AndEngine and I have this code:

@Override
    public boolean onSceneTouchEvent(TouchEvent event) {
        Log.d("upd", event.getX() + "");
        return true;
    }

And when I touching the screen, it prints huge 'random' number like this:

12-10 23:27:12.352: D/upd(18109): -543629.25
12-10 23:27:12.382: D/upd(18109): -827567.5
12-10 23:27:12.412: D/upd(18109): -292541.75
12-10 23:27:12.452: D/upd(18109): -50245.75
12-10 23:27:12.482: D/upd(18109): 160085.5
12-10 23:27:12.522: D/upd(18109): 164650.38
12-10 23:27:12.562: D/upd(18109): 285486.75
12-10 23:27:12.592: D/upd(18109): 68738.0
12-10 23:27:12.622: D/upd(18109): -282403.75
12-10 23:27:12.652: D/upd(18109): -629866.25
12-10 23:27:12.692: D/upd(18109): -553627.6

And so on.

The answer is:

@Override
    public boolean onSceneTouchEvent(TouchEvent touchEvent) {
        MotionEvent event = touchEvent.getMotionEvent();
        float x = event.getX();
        float y = event.getY();
        Log.d("upd", x + " " + y);
        return true;
    }
Vlad Markushin
  • 443
  • 1
  • 6
  • 24

0 Answers0