hi im trying to create a game in which few objects(UIImageViews) traverse the screen... these objects are generated at an interval of 1 to 0.45 seconds...when they r generating in the range of 1-0.60 seconds they traverse smoothly..but when they generate at a rate less than 0.6 seconds their movement is not smooth they start jerking..also i have a UIImageView which changes the position depending on the the touchesmoved event... please do help
-
Obviously your game uses too much cpu-power. Try optimizing it using a profiler (Shark for example) and make your object-creation method less time consuming. (Create a bunch of objects at one time and then just reuse them instead of making new ones?)
What's profiling?
I you don't know profiling at all, read this introduction written by Mike Ash. (Excellent blog btw.)
Here is Apple's Documentation of Shark.
Snehal : Actually i have created 10 UIImageView objects at the start of the game itself..and im reusing them..also i would like to add that in my game the user constantly moves another UIImageView by touchesmoved event if it help...and i dont think 10 UIImageView should matterGeorg : Try to profile it, that should show you all performance bottlenecks. (I suspect it's where you generate them, that it takes too much time.)Snehal : I dont get it? what do mean by profile it?? can u please elobrate on the same?Peter Hosey : Snehai: Read the answer. It has a section titled “What's profiling?”. Then read the links in that section.Georg : I've added that as an answer to his comment. :) -
hey guys I was able to solve the problem by creating 3 different threads ie one for generating the objects, one for traversing the objects and another for moving the object on the touches move event. I was previously using timers for it...
but using the threads solved the problem
Anyways thanks for all your help :)
0 comments:
Post a Comment