# Tag Info

12

Typically, the loading screen is presented so the user sees some kind of activity or indication that the game has not stalled while the game loads all the necessary data to play the level (or whatever), especially when loading the data might take a long time. If your game can already go directly to the gameplay without an unpleasantly long delay, then you ...

10

Well, you'll have to use a little bit of physics, but you don't need to simulate any physics. There are formulas for pendulum motion you can easily use to set the rotation of your pendulum. For small swings, the motion can be approximated with simple harmonic motion. The angular displacement at a specific time can be approximated with: This is most ...

4

Given the options in your question, separate timers would be the best approach. I'm not sure what your implementation of the "timers" is but you can get a major performance increase and simplify things by using a different approach. Rather than using timers (as in stop-watch type timing) you could use time stamps that represent the expiration of a cooldown ...

4

If the enemy waves only effect one player (the one that plays the game), then I really see no need to put this logic on an external server. Having a server would also require an internet connection which can't be taken for granted (especially on iPods and iPads). You could simply store the time when your game exits or goes to the background. Upon relaunch ...

3

Here is a no-trig calculation, derived from straight-forward Grade 11 Trig and Physics. It assumes that the origin is the lowest point of the pendulum bob's suspension, that L is the length of the pendulum, and that the normal graphics convention of y increasing down, and x increasing to the right is adopted: Update: I messed up yAcceleration initially; ...

3

Good points from NauticalMile. You could download one of many free textures that are already set up to tile nicely, or create one yourself using Photoshop or similar. To make the scaling match use the length of the wood pieces as the tiling factor. Alternately if you are strongly against visible repetition you could use a pixel shader instead of a texture. ...

3

There's a special class available in cocos2d that renders a ribbon of quads for you. At one point it was named CCRibbon, but I think it has been changed to CCMotionStreak (docs). It's designed to render trails or ribbons. I think using that class would be the most efficient way to create such an effect.

2

I'll share my design as of current implementation I did for my game. ObjectPool & Managers For objects whether it's enemy objects, collectable items, powers-up, effect (more like particle), etc, I managed them through my own implementation of ObjectPool as you will know roughly number of instances you would need in the game for certain time, so it will ...

2

This question is several weeks old, but I thought I would answer in the event you were still looking for assistance, or too perhaps help someone else down the line. Please note that the way you are loading the spritesheet using CCSpriteFrameCache is correct, but it does nothing more than add the contents of the spritesheet to memory. You then need 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

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

I am not seeing where you are positioning the particle system, only that you are adding it to "self". I assume you want the particle system to be more or less at the same position as the star sprite. Assuming "self" is a layer, you need to position the particle system using the position of the star sprite, and offset the position where needed. ...

1

Since you have already solved the first problem, I will only address the second problem The code you have does not really show where you generate the model, view & projection matrices, so it is difficult to exactly pin-point the problem position for you You should maintain separate View & Projection matrices. If you use a library such as glm, which ...

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

1

If you are using DFS starting from the top, all unvisited nodes should drop. The top should be an invisible node connected to all top bubbles (in the top row). One thing worth noting, is that unlike the current DFS which is checking for color equality, the functionality you should use for deciding which bubbles to drop because they are hanging in the air ...

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

Basic sprite animation is really simple: int frame_to_play = (game_tick * target_fps / tick_rate) % number_of_frames; The result will tell you which frame (the frame_to_play-th) to show. game_tick would be some kind of frame counter that just counts up (has to tick at least as fast as your animation is meant to be played). target_fps is the framerate at ...

1

it seems i was having memory Issue : i Change my code like this : In updateCacheImage method : You need to put Your imageContext in AutoReleaspool to free up your memory. @autoreleasepool { // init a context UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0.0); //End Context UIGraphicsEndImageContext(); } i also have make my ...

1

int Width = 2500; int Height = 1500; CCLayerPanZoom *Zooming = [[CCLayerPanZoom alloc] init]; self.Zooming.mode = kCCLayerPanZoomModeSheet; self.Zooming.panBoundsRect = CGRectMake( 0, 0, mapWidth, mapHeight ); // zooming level self.Zooming.minScale = 1.0f; self.Zooming.maxScale = 8.0f; self.Zooming.rubberEffectRatio = 0.0f; // center in the view ...

1

I think it's a matter of preference. Depending on the type of game, the MVC architecture might be a good fit, sometimes/mostly it will feel out of place though. I have used it for puzzle games before (eg. your board is the model, the controller handles user input and makes the changes on the board and a view that renders these changes). Another architecture ...

1

First, are you running on the simulator or a real iOS device? The device runs many times faster than the simulator. The simulator doesn't do hardware vertex processing. So the simulator slows down quite a bit with only a little load. If its slowing down on the simulator, that's not really an indication that it will be slow on an actual device at all. ...

1

in Cocos2D, doesn't the music continue to play until you pause or stop it? If I want to change music between CCScene I usually do something like: _dir->Instance()->getAudioEngine()->stopBackgroundMusic(); _dir->Instance()->getAudioEngine()->stopAllEffects(); // click! _dir->Instance()->getAudioEngine()->playEffect("click.mp3", ...

1

I just put my logic. You have updateRunning method, in this method you have a logic of move coin at right to left. Here you need to use CCMoveTo Action, // move the coin until it leaves the left edge of the screen if (coin.position.x > (coin.contentSize.width * (-1))) { [coin runAction: [CCSequence actions: // Here set MoveDuration as you need ...

1

I'd probably try to do something like the following: Store all your vertices as well as the edges connecting them. When an explosion happens, do the following: Remove all vertices within the explosion radius. Remove all edges within the explosion radius. Flag all vertices with removed edges as "dirty". After an explosion, iterate over all "dirty" ...

1

I'd advise that you prefer consuming memory to preserve CPU where possible. Keep scenes in memory as long as you can (or need to) to ensure a smooth transition experience for users. In other words, go with your first ("lazy loading") approach. By preserving the scene, you also allow yourself to preserve any scene state as well, which means you can (if you ...

1

Many individual timers can cause race conditions. Set one timer to 50 ms, 10 ms later set another timer to 40 ms. Which one will fire first? Often there is no way of knowing, and the result may be different from one run to another due to minor performance variations. Often it is not an issue, but bugs caused by race conditions can be really hard to track. ...

1

The problem is that you are moving the label to the right (420+10 points). I don't know what do you want to achieve with this action but basically you are continuously moving the label to the right. If you don't understand, change the duration of the animation to something like 2 and you will see the problem.

1

Instead of overriding the selected method, I simply used the isSelected variable. Change this: -(id)init{ CCMenuItemImage * moveLeftButton = [CCMenuItemImage itemFromNormalImage:@"Move Left Button.png" selectedImage:@"Move Left Button.png" target:self selector:@selector(moveLeftVoid:)]; } -(void)moveLeftVoid{ id moveLeft = [CCMoveBy ...

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