1

I'm trying to define an SKSprite Node SKSpriteNode *ball but I'm getting this message "use of undeclared identifier 'SKSpriteNode'"

I'm building my game with the help of SpriteBuilder Cocos2d and chipmunk physics using objective-C, my deployment target is IOS6 i tried to pot it to IOS7 but still the problem didn't get solved.

In my interface i included CCPhysicsCollisionDelegate. I can use and define CCSprite and CCPhysicsNode without any problems.

I'm trying to detect collisions using collisionBitMask

I read SKSpriteNode Class reference but didn't find anything useful for my problem or maybe i just didn't understand will https://developer.apple.com/library/ios/documentation/SpriteKit/Reference/SKSpriteNode_Ref/Reference/Reference.html#//apple_ref/occ/cl/SKSpriteNode

I captured the error that i get in Xcode "focus on the SKSpriteNode error" Capture from Xcode

Any help or hint would be appreciated ..

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
shadramon
  • 59
  • 8
  • 1
    you will want to use cocos2d-iphone/cocos2d-swift, not sprite kit. Sprite Kit won't work with chipmunk, and SpriteBuilder no longer supports creating Sprite Kit projects (it was never officially supported anyway). – CodeSmile Sep 03 '14 at 07:13
  • @LearnCocos2D Thanks for noting that.. i started my project in a wrong way and its my first experiences to do an iPhone game. – shadramon Sep 03 '14 at 09:46

1 Answers1

1

If you are using SpriteKit then you should import:

#import <SpriteKit/SpriteKit.h>

You should be using the Sprite Kit framework (among other frameworks):

SpriteKit.framework

And you should be using iOS 7 or higher since SpriteKit requires that.

But a better question is what are you trying to use? Are you using SpriteKit or cocos2d? Correct me if I am wrong but from the looks of it you have the two confused. SpriteKit and cocos2d are not one in the same and you wouldn't be using code from one in the other.

Allen S
  • 1,042
  • 2
  • 9
  • 14
  • Thank you this solved my problem.. I'm actually trying to make a maze game where the player moves an object inside the maze and he can't cross the maze boundaries thats why i wanna use collisionBitMask to detect that. what can i say its my first time to use all this frame works and libraries and its my first experience to build an iphone game .. so some stuff are still not clear to me.. i guess i won't be having to use SpriteKit in this project. Thanks for noting that – shadramon Sep 03 '14 at 09:44
  • Glad I helped solved the issue. Over time things will get more clear so don't worry about it being your first time. You are further along than many others when they attempted their first game. – Allen S Sep 03 '14 at 14:33