I'm currently building a game using Xcode, sprite kit and now tiled. The game is simple, a person jumping from 1 block to another, but if they hit the side it will be game over. Now is their anyway through tiled to create a block for the person to jump on. And through out the game to keep repeating and coming on for the person to jump on, I would like the object to have different heights and widths? Please Help?!
1 Answers
What you can go for is creating a reuse mechanism that will reuse nodes instead of creating and destroying them. A mechanism well-known from UITableView
or UICollectionView
.
You would implement a method:
- (SKNode *)dequeueReusableNode;
that gets reused SKNode
from some storage, say, NSMutableArray
(grabs first object from array, then deletes it from array and returns it). If array is empty, method returns nil
.
Then you check if you got a node from the dequeueReusableNode
method, if it's nil
, you create a new instance of a node. If it's not nil
, you configure it with your data.
This goes for every visible node that should be reused.
Nodes that went completely off-screen are sent to reuseQueue
– all their property values return to default state, and then node gets added to the end of the NSMutableArray
that is the reuseQueue
.

- 39,540
- 23
- 113
- 143
-
i'm a beginner at coding so could you give me more of a step by step? – user1483652 Feb 22 '14 at 22:15