Hi,
I'm having no end of trouble trying to preload my images that I want to use as CCSprites. They are really large since I need to zoom into one part of them. I've searched all through the forums over the last few days and looked at Textures and so on and just managed to confuse myself.
I have a number of Scenes which I use so I don't have to worry too much about memory. Each Scene had basically one line of code that adds the layer to it.
For Example
#import "HomeScene.h"
#import "HomeLayer.h"
@implementation HomeScene
- (id) init {
self = [super init];
if (self != nil) {
[self addChild:[HomeLayer node]];
}
return self;
}
- (void) dealloc {
[super dealloc];
}
@end
The basic structure of my app is
App Delegate
LoadingScene -> LoadingLayer
HomeScene -> HomeLayer
GameScene1 -> GameLayer1
etc.
To move between scenes I simply use this code
[[CCDirector sharedDirector] pushScene:[GameScene1 node]]
My problem is that I want to load a sprite ie.
theSprite = [CCSprite spriteWithFile:@"bigImage.jpg"];
in the LoadingScene but then use it in the the Game1Scene.
I may be being totally stupid. Is it possible to do this or does it gets cleared from memory when I push the scene?
Can I load it to a texture and then access it later? How would I do that?
At the moment when I begin my game from the HomeLayer there's an unacceptably long delay which may cause users to think the game has frozen.
Any help on this would be greatly appreciated.
Sorry if it's a stupid question.
Thanks,
Travis