I'm building a sprite kit based game, and the lack of "right click" is really making it hard to convey some important information to my users. As a solution, I'm thinking about gestures like long press, two finger tap, etc.
How can one implement gestures on a SKSpriteNode?
Here's what I'm currently using to get a button-like behavior when an SKSpriteNode is touched.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self selectSkill:YES];
}
There is no easy way to do it, but one way I can think of would be to add a sub SKView to your SKScene and place an UIImageView as the only thing inside that SKView. Then you can add a gesture recognizer like normal to the SKView.
Here's an example of what I'm talking about:
You can put the SKView wherever you want and use any of the gesture recognizers on an SKView:
UITapGestureRecognizer
,UILongPressGestureRecognizer
,UISwipeGestureRecognizer
,UIPinchGestureRecognizer
,UIRotationGestureRecognizer
,UIPanGestureRecognizer
, orUIScreenEdgePanGestureRecognizer
.Then for your method implementation do something like this: