I'm trying to make an android game with libgdx, and am having problems with detecting if a button is being held down. I want to be able to detect when a button is being held down because i want to move my character when the button is down and stop him when it is up.
I really just want the button to work like an arrow key on the keyboard.
This is what i'm currently using:
buttonRight.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
levels.get(index - 1).getBlackPoint().moveRight();
}
});
i've tried other ways like using a change listener, but couldn't get it to work.
I want to have four buttons on my gamescreen, left, right, up, down. Each button will move the character while the user is holding the button down. Once the button is released the character will stop moving until another one of the four buttons is held down.