Hi so I'm designing an iPhone application which requires 3 seperate scenes, one on the top, one in the middle (main) and one on the bottom which will hide and unhide according to user actions.
This is a requirement because I need the middle (main) scene to change upon a swipe gesture and the top/bottom scene to remain unchanged.
How can I do this?
PS:
I've looked the few questions/solutions and none give a straight-forward answer. I just need some real help, if that's alright!
well..easiest way i can think of is to make 3 layers in the same screen..and position them as you want
its easy enough to create a layer,
to change it's size just use [ <layer> setContentSize:...]
, to change it's position: <layer>.position=....
and to detect which layer is touched:
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint location = [self convertTouchToNodeSpace: touch];
if (CGRectContainsPoint(<layer1>.boundingBox, location))
{
CCLog(@"touched 1st layer");
return YES;
}
if (CGRectContainsPoint(<layer2>.boundingBox, location))
{
CCLog(@"touched 2nd layer");
return YES;
}
return NO;
}
also...for the 3rd layer just use CCMoveTo
to move the layer on and off the screen
Try it. may it should be helpful to you.
-(void) registerWithTouchDispatcher
{
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}