first of, I'm new to android game development so I don't know all the classes and dictionaries within android and libgdx. I'm actually following a game development tutorial for the first time (kilobolt) but I already have some ideas for games I want to make after finishing the tutorial. So here's my question:

Let's say you have a box with a small ball in it. When you touch-hold the ball, you hold the ball "in your hand". Then you swipe across the screen with the ball in hand and "let go" (release touch), the ball rolls in the direction you swiped with the speed of your swipe, decreasing in speed according to a set friction.

Is it possible to implement such a function with libgdx? If yes, could you please explain how to make it?


1 Answer 1


This may help a bit. As for knowing how to do what you exactly want to do, I would need hours of trial and error as I am also a bit of a beginner.

    public void create() {
        gestureDetector = new GestureDetector(HALF_TAP_SQUARE_SIZE,

The class that you are calling.

    public class GestureHandler implements GestureListener
        public boolean touchDown(float x, float y, int pointer, int
        public boolean tap(float x, float y, int count, int button);
        public boolean longPress(float x, float y);
        public boolean fling(float velocityX, float velocityY, int
        public boolean pan(float x, float y, float deltaX, float
        public boolean panStop(float x, float y, int pointer, int
        public boolean zoom(float initialDistance, float distance);
        public boolean pinch(Vector2 initialPointer1, Vector2
        initialPointer2, Vector2 pointer1, Vector2 pointer2);

I learned a lot from this guy, check him out https://www.youtube.com/watch?v=N9AqGS_Tlnw&list=PL6gx4Cwl9DGBsvRxJJOzG4r4k_zLKrnxl&index=75

Also check out the libGdx demos, gives a better understanding how what is used and how to organize files: https://github.com/libgdx/libgdx/wiki/Running-Demos

I hope this helps.

  • \$\begingroup\$ Victorsh thnx ! All the help is welcome! Just checked the youtube video, looks very promising! Thnx again \$\endgroup\$
    – DinoByte
    Commented Apr 1, 2015 at 20:44

You must log in to answer this question.

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