1

I'm trying to make a game i want to be able to press down on my gamePadUI to keep my character walking. Far as I can tell the TouchEvents only get called 1st time I push down on the screen

I have 2 methods called constantly update() which keeps track of my game states and in each state has TouchEvents, so in my Running state it will call updateRunning() and checks for TouchedEvent then map the the x and y points to my gamepadUI

The other is Present() which handles the drawing of each states.

so here is my updateRunning() method that tells the character to walk

      public void updateRunning(float deltaTime) {
    List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
    int len = touchEvents.size();
    for (int i = 0; i < len; i++) {
        Input.TouchEvent event = touchEvents.get(i);
        touchPoint.set(event.x, event.y);
        guiCam.touchToWorld(touchPoint);

        switch(event.type){
            case TouchEvent.TOUCH_DOWN:
                gamePad(deltaTime);
            case TouchEvent.TOUCH_DRAGGED:
                gamePad(deltaTime);
            case TouchEvent.TOUCH_UP:


        }
    }
}

I have tried looping the event but my present then will not get called for there the drawing will not get updated.

what can I do to make it keep TOUCH_DOWN going to call my gamepad method.

0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.