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!
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
frame jump in finished game
I have been playing this game on my iPhone and it still does frame jump? how can l resolve this?
The best way to fix the problem is to do what is called object pooling.
The reason for the frame jump is you are creating pieces of the ship, ships, and bullets and creating a lot at once. Creating new objects or allocating memory is an expensive task for the CPU. So you see the frame skip a bit.
Object pooling is where you create lets say 30 bullets ahead of time and track which ones are being used and which aren't Use the ones that are not being used and instead of deleting them when they are off screen you would put them back into the pool and use it later.
Easiest way to do it is precreate them on load and put them in an array. Then track which was the last one you took and take the next one.
If you do this for bullets and cats and pieces you will have no frame jump at all.
Which iPhone are you using? (4, 4s, 5, 5s) Are you loading the version from the store, or from the source? Where in the game does it start to frame jump? Can you relate any part of the game to when the frame jump happens, such as when you shoot?