Tag Info

Hot answers tagged

5

Plugins for Unity can be written using Objective C; refer to this page: http://docs.unity3d.com/Documentation/Manual/PluginsForIOS.html However I wouldn't assume that a code library of thousands of lines that wasn't designed to be used as a Unity plugin will work as a Unity plugin. It's all free so you could download Unity, fire up the demo project, and ...


2

General advice is to start with the switch statement. At some point you may notice that you're writing a lot of very similar code in different 'case' blocks within the switch statement. If and when you notice that, that's the time to refactor the code so that those similar cases can be coalesced into a single block. Until then, go with the switch ...


2

This also largely depends on how your character class is setup. Assuming we're using direct references here, I would actually refrain from storing your stats directly. Instead I might have the following: int Player::GetStrength() { return _stats.strength + equipment.GetStrength() + buffs.GetStrength(); } int Equipment::GetStrength() { return _head.strength ...


2

As mentioned in the answer you reference, this is sort of the artistic side of procedural generation. These are the kind of functions you just have to keep tweaking until you get something that works for you. Everyone is going to have different ways of generating terrain and even a number of different ways to generate noise. It's unlikely there's going to ...


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

If the only difference between the enemies are sprite changes and simple quantities (number of shots fired, rate of fire, etc), multiple classes would not be needed. This is exactly the sort of game Sprite-Kit was designed to make easily and quickly. Classes would be more appropriate if there was some unique behavior between the different kinds of enemy ...


1

CCParticleSystemBase has an autoRemoveOnFinish property. The name is self explanatory. This property is NO by default. So should be set to YES on creation for particles that have a finite lifetime.


1

The trick is to use the CCScrollViewDelegate methods to detect scroll events. Add a CCLabelTTF and call it _pageLabel. In Xcode, make the scene containing your scroll view adhere to the CCScrollViewDelegate : @interface myScene : CCNode <CCScrollViewDelegate> Then, in didLoadFromCCB, set the scroll view delegate to self : _scrollView.delegate = ...


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

By "endless levels" do you mean that there is no limit to the number of waves i.e. the waves keep coming until game-over? If so then you need to develop an algorithm that takes the wave number as an input and returns an set of enemies suitable for that wave. The most trivial of these would be to take the wave number and return a number of enemies or as ...


1

One alternative that avoids lengthy switch statements all over the program would be to define inside your Skill interface additional components that define its behavior. These components would be implementing an interface as well. For example, all skills might contain an attack behavior, which could look like: IAttackBehavior attackBehavior; Creating an ...



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