iphone - Preload images/sound to avoid lag -


im developing game have player shoots objects. when player shoots sound played. , when hits object generates explosion animation sound. im using uiimageviews draw player , object , use audioservicesplaysystemsound play sounds.

the problem i'm experiencing game "lags" first time shoot , first time hit object. think because these objects not yet loaded in memory because it's first time these objects generated problems occur. after first time game doesn't suffer lag.

is there way preload these objects in memory game doesn't lag each time new object generated first time?

just place creation of uiimage instances , calls of audioservicescreatesystemsoundid() in method runs before gameplay starts. long resources small enough fit memory, should it.

you should listen memory warnings, though, , release objects not in use free memory possible. user prefers slight lag when reloading these objects on app crashing because ran out of memory.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -