views:

126

answers:

3

Hi all,

I am developing a game in which i have to move the ball and power up image simultaneously. For move a power up image view, I create a separate thread and call move method of power by using [self performSelectorOnMainThread:..], this is required to show the updated position on view. But my Game slowdown after creating this thread. please guide me in improving the performance of game.

+1  A: 

You probably don't want to be creating your own thread here; that's probably slower than doing this work on the main thread unless your calculations are incredibly complicated.

Instead of creating your own threads, investigate CoreAnimation. It's designed to handled moving things around smoothly, manages its own threads transparently, and provides a "fire-and-forget" interface. For most 2D games, the first approach you should follow is CALayers for each element moved around using CoreAnimation.

Rob Napier
Agreed. The discussion on this question might be useful to him: http://stackoverflow.com/questions/595922/how-do-i-prevent-core-animation-blocking-my-main-thread .
Brad Larson
+1  A: 

We didn't design or write your game so how can we be expected to know how to magically fix it for you? Do some research of your own, use Apple's excellent "Instruments" and "Shark" tools for tracking down the problem(s).

Mike Abdullah
That was kind of harsh.
willc2
But fair and accurate.
Mike Abdullah
A: 

I strongly suggest you look at cocos2d instead of manually managing sprites and graphics. Cocos2d will abstract all of that stuff away from you.

EightyEight