How to visualize many SpriteKit nodes at once?

I use SpriteKit to render a large (20 x 20) dot grid that looks like this: enter image description here

I want to highlight rows or columns based on user input. For example, I would like to change rows 1-10 to red or columns 5-15 to blue.

What is the most efficient way to do this?

I tried:

  • Naming each GridNodebased on its column (e.g., @"column-4). Then use enumerateChildNodesWithName:with the how string by @"column-n"changing the color of each node (by changing SKShapeNodesetFillColor :) in the enum block.
  • Providing all columns with the parent node associated with this column. Then tell the parent node to change its alpha (thus changing the alpha of all its children).
  • , node .

GridDot a SKEffectNode shouldRasterize: YES. SKShapeNode, SKSpriteNode . SKEffectNode SKSpriteNode.

~ 10 FPS. / ( )?

, ?

+4
2

SKShapeNode, :

  • SKShapeNode .
  • SKView textureFromNode:crop: SKShapeNode SKTexture
  • 1,2, node.
  • SKSpriteNode
  • SKSpriteNode SKShapeNode
  • node, SKSpriteNode texture

, , aproach .

+3

@amobi, 400 . , ~ 400 9,8 9 .

400 , . , , ( ) . ViewController SpriteKit, SpriteKit.

    skView.showsFPS = YES;
    skView.showsNodeCount = YES;
    skView.showsDrawCount = YES;

SKView ignoresSiblingOrder. , SKSpriteNodes zPosition , ( /) . -viewDidLoad SKView ViewController.

    skView.ignoresSiblingOrder = YES;

, GPU SKEffectNodes . , .

, . , , . Profiler, Xcode . FPS Simulator .

+3

All Articles