Is it possible to use a swipe function on CCGameView?

Is it possible to use a swipe function on CCGameView?

Answers

  • IlledanIlledan NOMember ✭✭
            var touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesMoved = OnTouchesMoved;
            AddEventListener (touchListener, this);
    

    void OnTouchesMoved (List<CCTouch> touches, CCEvent touchEvent)

    Then simply loop through touches finding distance between their PreviousLocation & Location

  • DuITAppsDuITApps USMember ✭✭
    edited August 2016

    Have you tried using touches[0].DELTA ? For example. b2Body.ApplyForceToCenter(new beVec2(touches[0].DELTA.X, touches[0].DELTA.Y)

  • Ruslan0990Ruslan0990 DEMember ✭✭

    I have a simple implementation set up using the stopwatch to detect swipe duration and by calculating the distance of the swipe in a certain direction. Then you just define your thresholds for maximal duration and minimal distance of the swipe. I could share it later if you want.

Sign In or Register to comment.