I want to make it so that a child sprite follows its corresponding parent sprite. The child sprite has a physics body which should not mess with the parent's physics body. I have tried to in the parent sprite's subclass to override these functions like this:
public override func run(_ action: SKAction) {
super.run(action)
physicsSprite.run(action)
}
public override func run(_ action: SKAction, withKey key: String) {
super.run(action, withKey: key)
physicsSprite.run(action, withKey: key)
}
public override func removeAllActions() {
super.removeAllActions()
physicsSprite.removeAllActions()
}
with no success however :(
I'am exclusively moving the parent sprite with SKActions.
The result is that the sprites don't stick together.
physicsSprite.zPosition = 10
physicsSprite.physicsBody = SKPhysicsBody(circleOfRadius: playerInfo.width+2)
physicsSprite.physicsBody?.affectedByGravity = false
physicsSprite.physicsBody?.isDynamic = false
physicsSprite.physicsBody?.restitution = 0
physicsSprite.physicsBody?.collisionBitMask = 0
addChild(physicsSprite)
In this case physicsSprite is the childNode in a SKSpriteNode subclass. Thanks in advance