swift - Splitting touchesMoved across a single SKSpriteNode -
using spritekit, have created skspritenode called lightsaber, , using touchesmoved method, able either rotate skspritenode or translate left or right. there way make 1 or either depending on grab skspritenode? (e.g. blade or handle)
you position of touchevent via
cgpoint location = [touch locationinnode:self];
this give capability add custom logic touch screen. example:
if(location.x > 300) { //do } else { //do }
you make sword in 2 pieces, i.e 2 nodes , name each node , listen touch event on both nodes.
get node within touchesbegan
by
sknode *node = [self nodeatpoint:location]; if([node.name isequaltostring@"handle"]) { } else if ([node.name isequaltostring@"blade"]) { }
Comments
Post a Comment