Cocos2d: Reuse sprites

Member
Posts: 22
Joined: 2008.10
Post: #1
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:

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?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  z-order for map elements and sprites in cocos2d brokenPlatypus 3 6,234 Apr 27, 2009 03:42 PM
Last Post: LetoK