Search code examples
swiftsprite-kitnodesimage-rotation

Link node to an other node SpriteKit - Swift


I'm creating a game, I have a grid and a ball, and I want that the ball follow the position of the grid, please see the image.

How can I do it ?

Image of my game


Solution

  • You should add the ball as a child node of the grid. For example:

    grid.addChild(ball)
    

    For more information see Creating the Node Tree in the documentation: https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Nodes/Nodes.html