I am trying to create an animated motive class, in which to start and stop the animation. When I take my CCSprite variable from local to an Iver, the class throws an exception. In the local form, with the CCSprite variable, class work, this phantom is visible and animated.
This project has been enabled ARC, in which all the Cox 2D files have been flagged with -fno-objc-arc. I used to make the texture to make the underlying files, but I do not think there is anything to do with the problem.
What am I doing?
Cocos 2D version 2.01.00Xcode version 4.6.2
How the class is being called:
CCSpriteBatchNode * animatedSprite = [[ Animatedprint alloc] init]; AnimatedSpact.power = CCP (winSize.width / 2, winSize.height / 2); [Add Yourself: Animated Site]; Category header
#import & lt; Foundation / Foundation. H & gt; #import "cocos2d.h" @interface AnimatedSprite: CCSpriteBatchNode {} @end works that class
#import "AnimatedSprite.h" @ Interface AnimatedSprite () {CCAction * Action; // CCSprite * sprite; } @end @implementation AnimatedSprite - (id) init {if (self = [super init]) {[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @ "spriteSheet.plist"]; Self = [CCSpriteBatchNode batch nodewithfile: @ "Precise page"]; NSMutableArray * Animated Frames = [NSMutableArray Array]; (Int i = 1; i & lt; = 4; i ++) {[animatedFrames addObject: [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat: @ "Sprite% d.png", I]]]; } CCSprite * sprite = [CCSprite spriteWithSpriteFrameName: @ "sprite1.png"]; // sprat = [CCSprakash Spit with SprintFrameName: @ "Sprite 1Page"]; Cc animation * animation = [cc animation animationwrightframes: animated frames delayed by 0.1f]; Verb = [CCRepeatArrowAutverctionActionAction: [CC irregular action with animation: animation]]; [Phantom run action: Action]; [Add soul to child: phantom]; } Healthy return; } @end The class which throws an exception
#import "AnimatedSprite.h" @ Interface Animated Site () {CCAction * action; CCSprite * Phantom; } @end @implementation AnimatedSprite - (id) init {if (self = [super init]) {[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @ "spriteSheet.plist"]; Self = [CCSpriteBatchNode batch nodewithfile: @ "Precise page"]; NSMutableArray * Animated Frames = [NSMutableArray Array]; (Int i = 1; i & lt; = 4; i ++) {[animatedFrames addObject: [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat: @ "Sprite% d.png", I]]]; } // CCSprite * sprite = [CCSprite spriteWithSpriteFrameName: @ "sprite1.png"]; Phantom = [CCSprakash Spit with AsprintFrameName: @ "Sprite 1Page"]; Cc animation * animation = [cc animation animationwrightframes: animated frames delayed by 0.1f]; Verb = [CCRepeatArrowAutverctionActionAction: [CC irregular action with animation: animation]]; [Phantom run action: Action]; [Add soul to child: phantom]; } Healthy return; } @end stack trace
objc_release # 0 0x01efc0ab () # 1 0x01efcbd9 (anonymous name space) :: AutoreleasePoolPage :: in pop (zero *) () # 2 0x024ae468 (in _CFAutoreleasePoolPop) # 3 in 0x0156f8e4 - _PurpleEventCallback [NSAutoreleasePool release] (in _UIApplicationHandleEvent in) # 4 0x00abbc16 () # 5 0x03214df9 () # (in 6 0x03214ad0 PurpleEventCallback in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__) # 7 0x02481bf5 () # 8 in 0x02481962 __CFRunLoopDoSource1 () # 9 0x024b2bb6 __CFRunLoopRun () # 10 (in 0x024b1f44 CFRunLoopRunSpecific) # (in 11 0x024b1e1b CFRunLoopRunInMode) # 12 in 0x00ab717a - [UIApplication _run] () # 13 0x00ab8ffc (in UIApplicationMain) # 14 0x000dcc66 main In / iPhone Apps / Cocos / SpriteTest / SpriteTest / main.m: 15 # 15 0x000022b5 Initially ()
Why are you trying to create a square Does Phantom Animation? There are many things that work for you. Watch they do the animation for you automatically. There is no need to revise some of the things already existing for you :)
No comments:
Post a Comment