Tag Info

New answers tagged

0

You could use CCMotionStreak to achieve a nice fade effect for your line. This is how CCMotionStreak looks like. If you want a simple line, without any fancy effects, then you can use the method [drawSegmentFrom] of CCDrawNode.


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. ...


0

It's simple z_order = position_y Where axis origin is top left corner of screen(in cocos2d, it's bottom left). Player has origin at right between his foot. tree has origin at it's root..... If the map has size of 100x100, and player are at map's limit, his z_order must be 100. If 2 character are at the same y position, their z_order are equal too.


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++; } }


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 *) ...


0

I come from a C# background, so I can't write you the code (don't want to give you gross, translated Objective-C code :)) But what you could do is loop through the Children ([self children]), check if they can be casted as a Seal. If the casted object is not null, increment a counter. Then just return the counter after the loop is finished. Hope this ...


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. ...



Top 50 recent answers are included