Tag Info

Hot answers tagged

2

Do as ryrich said, however the actual code on Objective-C would be something like this: (Assuming your CCNode class is called "Seal") int sealCounter = 0; for (id *node in self.children) { if ([node isKindOfClass:[Seal class]]) { sealCounter++; } }


2

Let's speak radians. Your angle is clamped to a real range and from what I can see from your video I would say between −π/2 and 3π/2. Now you can also view angles in different ways, for example as points on a circle. This is clearly the intuitive way to see your problem : in your case the tip of your ship is the considered “angle point” on the circle. ...


1

Well, one way is to load the textures and keep a reference to them ourself. You could reimplement your code to something like: @interface TextureHelper : NSObject - (void) preloadTextures; - (CCTexture2D *) textureForImageNamed:(NSString *) imageName; @end @implementation TextureHelper { NSArray * loadedTextures; } - (CCTexture *) ...


1

This work! in cocos2d 3.x NSMutableArray *frames = [NSMutableArray array]; int frameCount = 0; for (int i = 1; i <= 5; i++) { CCSpriteFrame *frame = [CCSpriteFrame frameWithImageNamed:[NSString stringWithFormat:@"dice0%d.png",i]]; [frames addObject:frame]; } CCSprite *sprite = [CCSprite ...


1

It appears that setting self.hitAreaExpansion might be the answer, however it only needs to be set to the difference between the edge of the view field and the edge of the map, for the largest difference on either axis. In this case the map is square, 1600 x 1600, and the view port is 320 x 480, so the greatest distance is 1600 - 320 = 1280. ...



Only top voted, non community-wiki answers of a minimum length are eligible