Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Efficient node movement using Update method

Hello everyone,

I'm currently working on a side scrolling game that continuously loads nodes as the game progresses.

I noticed that the game gets a little jumpy on devices with less computing power and it seems that the issue is the fact that I am setting my node's position in the update method.

Unfortunately, most of the documentation for best practices on the Cocos2d website has been removed.

Example code:

- (void)update:(CCTime)delta {

_myNode.position = ccp(_myNode.position.x + delta * _scrollSpeed, _myNode.position.y);

}

Is anyone aware of a more efficient way to accomplish this? I have been considering using a schedule method for movement, but I think that I would run into the same issues.

Thanks, Calvin

1 Answer

I don't know if you've solved this but using SKAction always seemed to make it more smooth for me