Cocos2d: Reuse sprites
Hi!
I'm trying to figure out a way to reuse my sprites in a good way to enhance performance a bit. Im making a star sky that moves from left to right and repeats, for this i use 3 different textures to get som variety on the stars, but for every star i create i has to load the image:
Does this read the file every time that lines runs or will it remember and cache all the images? If it doesn't, is there a better way to do this? Maybe you can clone the first star to produce the rest?
I'm trying to figure out a way to reuse my sprites in a good way to enhance performance a bit. Im making a star sky that moves from left to right and repeats, for this i use 3 different textures to get som variety on the stars, but for every star i create i has to load the image:
Code:
Sprite * star = [Sprite spriteWithFile:starSpriteFileName];Does this read the file every time that lines runs or will it remember and cache all the images? If it doesn't, is there a better way to do this? Maybe you can clone the first star to produce the rest?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| z-order for map elements and sprites in cocos2d | brokenPlatypus | 3 | 5,522 |
Apr 27, 2009 03:42 PM Last Post: LetoK |
|

