我发现很难从文档中学习如何使用 Kobold2D KKInput gestureSwipeDirection 来检测向左/向右/向上/向下滑动并让它们执行 if else 语句。任何人都可以通过向我提供示例代码来提供帮助。谢谢
KKInput* input = [KKInput sharedInput];
KKSwipeGestureDirection dir = input.gestureSwipeDirection;
switch (dir)
{
case KKSwipeGestureDirectionRight:
// direction-specific code here
break;
case KKSwipeGestureDirectionLeft:
// direction-specific code here
break;
case KKSwipeGestureDirectionUp:
// direction-specific code here
break;
case KKSwipeGestureDirectionDown:
// direction-specific code here
break;
}