3

I'm looking at the userData property of SKNode and noticed this statement:

Sprite Kit does not do anything with the data stored in the node. However, the data is archived when the node is archived.

This got me thinking - is it possible to implement a single save game functionality by archiving the scene and all of it's dependents/controllers?

I'm trying to understand if there's some magical [archive] message that I can send to the scene or scene view to remove the need for writing custom data structures to store save game.

san
  • 3,350
  • 1
  • 28
  • 40
Alex Stone
  • 46,408
  • 55
  • 231
  • 407

1 Answers1

5

Check this out. From the SpriteKit Programming Guide:

Because all Sprite Kit classes support archiving, you can simply create archives of important Sprite Kit objects and then include these archives in your game. For example, you might:

  • Store a game level as an archive of a scene node. This archive includes the scene, all of its descendants in the node tree, and all
    of their connected physics bodies, joints, and actions.
  • Store individual archives for specific pre-configured nodes, such a node for each monster. Then, when a new monster needs to be created,
    you load it from the archive.
  • Store saved games as a scene archive.
Bishop
  • 115
  • 1
  • 8