# Tag Info

14

It is possible to approximate a solution to this problem for most parametric trajectories. The idea is the following: if you zoom deep enough on a curve, you cannot tell the curve itself from its tangent at that point. By making this assumption, there is no need to precompute anything more than two vectors (three for cubic Bezier curves, etc.). So for a ...

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

I found the implementation description from the author of this effect: It surely was a lot of work to create the depth illusion in a 2D plane. The principle is very easy though: circles start in the middle of the screen with scale 0. Then the first circle of the tunnel starts scaling proportionally to the time elapsed (linear scaling doesn't work) ...

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

9

The Snake game is one of the most simplest yet addicting games built ever. I'll show you its implementation idea without code. Consider an array containing n elements as in snake[n], where snake[0] is the head of the snake. Each element in the array snake i.e. for every snake[i] there should exist some mechanism to store its x and y coordinates.(I preferred ...

9

You use b2ContactListener http://www.box2d.org/manual.html#_Toc258082975 http://www.emanueleferonato.com/2008/12/23/understanding-how-box2d-manages-collisions/

9

My approach to this is two-fold First, I abstract the source of control for every game object. That lets me implement a "user controlled entity", which takes input from gamepad/keyboard/mouse/etc for the player entity, and implement AI routines for NPCs. Second, each entity can only express an "intent" ... so the output from the abstracted control object ...

8

My question is, is this right? Is this the pattern that people use in game development? Game developers tend to use whatever works. It's not rigorous, but hey, it ships. It somehow goes against everything I'm used to, to have my Ball class do everything. So, a more generalized idiom for what you have there is handleMessages/update/draw. In systems ...

8

That method of moving a player left and right is a little bit complicated and can be done in a much much nicer way using a simpler class design. Create a player class and declare cgpoint vel and pos. You will also want a CCSprite in the header file of this class: @interface player : CCLayer { CCSprite *spriteName; CGPoint vel; CGPoint pos; } @...

7

I'd basically create a 2x2 tilemap where the tiles happen to be 512x512 and all the same. Scroll through it as you would normally but as soon as X gets over 512 subtract 512 (or do a modulo 512 - but beware of negative numbers), same for Y. So instead of one poly you draw 4, although only 1 will be visible most of the time, but on border cases all 4 are ...

7

After a few days of researching, I found a solution to this particular transform. This is much more mathematical than program-oriented. Therefore, I will be using pseudo code. Now, given a screen coordinate (x,y), we first want to represent (x,y) respected, or fixed, to the world, not the screen. For example, my game use the top-left most corner of ...

6

For the Pirate Poppers puzzle mode, I generated the levels randomly based on some parameters related to difficulty. Difficulty is always difficult to measure objectively, but in this case there were some variables that were good indicators (chain length, number of different colors, nesting level of the combos) so I was able to generate pretty good puzzles ...

5

Off the top of my head, if negative scores are not allowed: track positive and negative scores separately. For instance, when writing the leaderboard: // Pseudocode points_for_win = 3; points_for_loss = 2; if (didWin) leaderboard.positive_score += points_for_win; else leaderboard.negative_score += points_for_loss; When retrieving the leaderboard,...

5

There has been a lot of discussion on this very topic on the Box2D forums. You'll find most of the info under the guise of breakable bodies, which is your problem in reverse. Here are my suggestions in order of easiness: Depending on the situation you could just change the animation of the main character to show that he is now carrying the item without ...

5

In all honesty, it's probably down to what sounds best at the lowest bitrate. So if you had music at 192kbps but you could still get it sounding decent without a whole lot of quality loss at, say, 64kbps, then you've got no reason not to use the 64kbps version. It might be worth having a bunch of different bitrates of the same song and see which "sounds" ...

5

I recently made a simple Space Invadors game using an 'entity system'. It's a pattern that separates attributes and behaviours extremely well. It took me a few iterations to fully understand it, but once you get a few components designed it becomes extremely simples to compose new objects using your existing components. You should read this: http://t-...

5

Try this: http://www.learn-cocos2d.com/

5

The easy/naive solution would simply be to take your existing points, and for each point have a corresponding point that's at the same Y position but off screen. From there, create your polygon by taking, say, points 0, 1, 1's pair, and 0's pair and pass that to your DrawPoly method. Then continue on with (1, 2, 2's pair, 1's pair), etc.

5

I think the best Idea is to go with the real time generation since there are always some nerds who break every limit you put for yuor game. for example if you go with 5000 nodes there will be some people to player far past it just like what happen to pacman, none of the developers never tought of someone go beyond level 255, but there were geeks to break ...

5

You can get the reference to opengl view with: [[CCDirector sharedDirector] openGLView] With that any UIView's can be added as subview of that opengl view as follows: UIButton *myButton; //initialise myButton here [[[CCDirector sharedDirector] openGLView] addSubView:myButton];

5

I can't tell you about cocos2d specifically, but in general, tap vs. drag is the same input recognition problem as mouse click vs. drag. The standard way to handle this is to note when a mousedown (or touch) happens, and store where it happened, for later reference. Watch for mousemoved (or touchmoved) events to see if it moves around. If it moves to a ...

5

Since you have pre-made break patterns. All you really need to do is collect a sub-image for each one to show. This would likely be easiest to do with a rectangle for each shape. The rectangle should encompass the entire shape. Now break the image up into these rectangles. There will be overlap. Now apply an alpha mask to each rectangle to hide everything ...

5

On iOS there are two different units of measurement. Points and Pixels. On older devices a point is equal to a pixel. On new devices, there are two pixels for each point, both vertically and horizontally (so totally 4 pixels per point). An iPhone 3 has 480x320 pixels and 480x320 points. Whereas an iPhone 4 has 960x640 pixels and 480x320 points! The important ...

5

There are various scaling algorithms that are specifically crafted for enlarging pixel art for modern displays. They usually work with factors 2x or 3x and produce nice non-blurred and non-blocky results. Take a look at this Wikipedia article, which has many examples.

5

You can only call [self presentModalViewController...] from a UIViewController (or one of its subclasses). In Cocos2d 2.0, the CCDirector is a subclass of UIViewController, so you can do something like: [[CCDirector sharedDirector] presentModalViewController...] (In previous versions of Cocos2d, I think you need to latch back to the RootViewController, ...

5

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

It sounds like you essentially want to have specific objects ignore gravity, is that correct? Since gravity is a property of the world object, it looks like the way to do this is to either Disable gravity entirely, and then manually apply gravity to every object you want to have it (ignoring the objects you don't want to be affected by gravity), or Apply a ...

4

I have never used Corona, but it looks nice. Especially the easy deployment to different platforms makes it interesting if you plan to release for Android and iOS. The problem with an engine like Corona or Unity is, that you're mostly limited to what they include in their API. Apparently corona doesn't come with a particle engine (you'll need a license for ...

4

For 2d game, cocos2d is surely preferable. Unity makes it easy for 3d apps, and the features that make it great for 3d will not be used in your project at all. Also considering unity is cross-platform, while cocos is single platform, that keeps you out of unnecessary overhead that is present in the engine. Cocos2d is also very polished and easy to use - ...

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