草庐IT

ios - 真的需要SKSpriteNode child 才能正确射击

所以我有一个shipNode(最初是面向右的)和两个子节点_laserCannon1(和2),它们是通过以下方法配置的:-(void)initializeLaserCannonLocations{CGSizesize=CGSizeMake(4.0,4.0);_laserCannon1=[SKSpriteNodespriteNodeWithColor:[SKColoryellowColor]size:size];_laserCannon2=[SKSpriteNodespriteNodeWithColor:[SKColoryellowColor]size:size];_laserCanno

ios - 通过触摸以有限的旋转速度旋转 Sprite

我试图让我的spriteNode在手指触摸时旋转。到目前为止我可以做到,但我想要的是我的节点有一个“旋转速度”。所以我计算角度的长度然后设置不同的时间来旋转它(如果弧长,则需要时间......)。这是我的代码:overridefunctouchesMoved(touches:NSSet,withEventevent:UIEvent){_isTouched=truefortouchintouches{letlocation:CGVector=touch.locationInNode(self)-miner.positionminer.weaponRotation=location.ang