Now I have problems with my game, it continues to fall when I emphasize it too much. This means that I am madly crawling, moving or tapping my fingers on the screen, and it will collapse. The accident has no rule. I tried to detect that a low memory warning message was displayed in the console log. I know that we are talking about memory materials, but I use Cocos2D to create this game, I followed the instructions in best practice. After that it seems smoother, but still crashes if I like what I said above. If you like Cocoa, we select and release, but Cocos2D, I think, we don’t need to do this. My game just downloads the images and makes the animation after touching.
-(BOOL)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)events
{
int touchCount = 0;
NSSet *allTouches3 = [events allTouches];
for( UITouch *touch in allTouches3)
{
location3 = [touch locationInView: [touch view]];
location3 = [[Director sharedDirector] convertCoordinate: location3];
NSLog(@"end TOUCHed x2: %3.3f, y2: %3.3f",location3.x,location3.y);
touchCount++;
}
[self removeChildByTag:kTagWord cleanup:YES];
timeEnd = [NSDate timeIntervalSinceReferenceDate];
touchDuration = timeEnd - timeStart;
rangeY2 = location3.y - location.y;
if ((touchCount > 0 && touchCount ==2) && (rangeY2 > 0.0 && rangeY2 <15.0))
{
box++;
self.isTouchEnabled = NO;
[self removeErrorText];
if (box == 1)
{
[self loadingTheRest];
}
else if (box == 2)
{
[self loadingTheRest1];
}
else if (box ==3)
{
[self loadingTheRest2];
}
if (currentBox == 0 )
{
[self addText];
[self boxOpenAnimation];
[self schedule:@selector(enableTheTouches) interval:1.0f];
} else if(currentBox == 1 )
{
[self addText1];
[self boxOpenAnimationPink];
[self schedule:@selector(enableTheTouches) interval:1.0f];
}
}
}
and this is an example of a boot box
-(void)loadingTheRest
{
AtlasSpriteManager *managerPink = [AtlasSpriteManager spriteManagerWithFile:@"PinkNew.png"];
AtlasSpriteManager *error2 = [AtlasSpriteManager spriteManagerWithFile:@"PinkErrors.png"];
[self addChild:managerPink z:1 tag:kTagSpriteManagerPink ];
[self addChild:error2 z:1 tag:kTagSpriteErrorPink ];
}
-(void)boxOpenAnimation
{
if (isBusy==YES)
{
return;
}
isBusy=YES;
[self removeBoxColours];
AtlasSpriteManager *mrg = (AtlasSpriteManager *)[self getChildByTag:kTagSpriteManager];
AtlasSprite *box = [AtlasSprite spriteWithRect:CGRectMake(482, 322,480, 320) spriteManager:mrg];
box.position = ccp(240,160);
[mrg addChild:bra z:1 tag:1984];
AtlasAnimation *animation = [AtlasAnimation animationWithName:@"open" delay:0.1];
[animation addFrameWithRect: CGRectMake(1, 322, 480, 320) ];
[animation addFrameWithRect:CGRectMake(482, 1, 480, 320)];
[animation addFrameWithRect:CGRectMake(1, 1, 480, 320)];
[animation addFrameWithRect:CGRectMake(1, 643, 480, 320)];
id action = [Animate actionWithAnimation:animation];
[box runAction:action];
[self loadingTheRest];
isBusy=NO;
}
, , .
.