I'm am going to assume that you actually have something on the ground (like a ground plane) for the body to hit.
First, to detect the long mouse click, and assuming you are using cocos2d-x, you are going to need a way to detect the long mouse click.
For that, you will either need to key off the touch events in your scene or create a class that handles long touches. For that, here are a couple of options:
- Use the CCLongPressGestureRecognizer found here.
- Use the TapDragPinchInput class found here (with full demonstration of using it in MainScene.cpp).
From what you want, I would favor the second, since it gives a call when the finger goes down and then comes up.
For the rest of it, you can set the velocity based on the mouse events. Or apply forces to the bodies to make them move.