Zach Russell
Zach Russell

Reputation: 21

How do you maintain low energy impact when adding many SKSpriteNodes in a SpriteKit game

I've currently been working on a battle scene for my app similar to what you would see in pokemon, with HUD for each character (3 characters per side). For each label and image I have been using

addChild(SKSpriteNode)

adding each label and character to the screen individually. At its current state my screen has 70 nodes on it and my draw count is over 100 making things very laggy. What is a more efficient way to do this?

Upvotes: 0

Views: 42

Answers (1)

bg2b
bg2b

Reputation: 1979

Make sure ignoresSiblingOrder is true (use zPosition to control the layering and try to keep the number of distinct positions small). If your sprite nodes have different textures, be sure they're in an atlas. And avoid shape and label nodes.

Upvotes: 2

Related Questions