Tag Info

Hot answers tagged

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


9

There's a very easy solution for that particular example. I'm assuming your arbitrary shape is just a series of points. Draw a ray from each of your objects in any direction. If the number of times it intersects a line segment on your shape is even (including zero), you are outside of the shape. If the number of times you intersect is odd, you are inside ...


7

If you're going to use a perspective camera like that, you're really not saving anything by using a sprite sheet. I mean I guess you could render all of the potential walls in one quarter of the screen and then do mirroring for the other 3 quadrants, but that assumes a stationary camera. Why would you want to use a sprite sheet anyway? You're not really ...


7

From the image you posted it looks like the only thing you did wrong was the order in which you applied the scale and rotation to your transformation. I don't have any experience with Cocos2D but I just mocked it up in XNA and here are the results: And here's the transformation matrix I used in XNA. See if you can find any correlation to your code: ...


7

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


6

Scripting is generally used in bigger projects to allow non-programmers to easily add content to the game. This can be new quests, interfaces, gameplay for levels, etc. A scripting language in itself shouldn't be difficult for a programmer to learn, what will take time is the integration into your game framework. Whether it's worth it or not is really your ...


6

There's an article on GDNet about walls and shadows in 2D; the technique can be applied to visibility determination as well. Additionally there this old-school post on 2D visibility, this post on StackOverflow and a variety of other resources online you can find via Google. Once you have a logical understanding of the visibility region for an agent in your ...


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

Do it via events. Spell begin is an event. Start playing the sound for that event. Enemy getting hit by spell is also an event. If the enemy is further away and you Throw a dart, for example, you only play the second sound (dart hitting) once the dart reaches the target (if you consider Throw as a spell). If you need to tie it to a frame (so for ...


4

Here is the way generally followed to sub-class a CCSprite. public class CharacterSprite extends CCSprite { // Add new custom fields or methods here, // or override the specific methods of CCSprite // that you want to extend the functionality of. } From your question I can understand that you are inheriting CCSprite ...


4

Both are valid choices, but with Unity3D it's going to be much simpler to achieve what you want, mainly because: Unity3D has a much easier content-pipeline. You can simply drop a lot of different image- and 3D formats into Unity and work with them, while cocos3d requires models to be in PowerVR POD format. Unity3D has/is a visual editor, which makes it ...


4

There are numerous ways of smoothening a rotation. If there is any physical meaning to it, we'll need to know what that is, but if you are merely doing it to make it appear less jerky, it is pretty arbitrary. Note that unless you know what the velocity is going to do in advance, any attempt to smoothen the corresponding rotation will cause it to lag behind ...


4

There are several ways to go about this. Here are some ideas: Pre-rendered animations Use a 3D rendering and animation software to animate 6 different die rolls. The advantage of this is that you don't need any 3D library, as you can show the rendered animations in a 2D context. Also pre-rendered animations give you lots of artistic freedom. In your game ...


4

Lag results from the speed of light limitation, and the processing speed of network protocol translation and switching in intermediate networking devices and at end points. From yours and your players' point of view, these are invariant factors. Game that deal effectively with lag do so by adjusting player perception of the impacts of lag. One example is in ...


4

I will talk how I render those things in my game. My background (parallax) is divided in four segments. The game starts with the three segments on the screen, but as the player moves forward, the forth start showing up and the first starts disappearing (in the left side). Once it completes disappear, I move that segment to the front, and keep doing it. ...


4

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


4

My second question is that my actual game scene uses bound camera and I perform scrolling on that camera but my other scene uses the normal camera. So in this situation what to do? how to use multiple camera for single engine? or how to reset available current camera? Our 3d game engine allows us to create as many render targets we wish. A render ...


4

Use Approach #2 (render to a small offscreen texture, then display that texture onscreen scaled up using nearest-neighbor texture sampling), because: The asset workflow is simpler. You can edit individual pixels, without having to quadruplicate them, or manually scale everything up. The assets will probably take up less space on disk. This is ...


4

Frames Per Second (FPS) should be just that. The number of frames drawn every second. What FPS is not is something that you should be basing your gameplay timings around. You are running into issues when spawning enemies according to elapsed time because the rest of your game is not based around time, I bet. In your current setup I imagine you are updating ...


4

I think your basic idea is sound. I'll summarize what your current code is doing. To get the average normal within an area around a point, you're gathering all the pixels in a rectangle centered on that point. For all the pixels in the rectangle that are solid ground, you're averaging the vector from the pixel to the query point. Effectively you're ...


3

It's often better to prefer composition to inheritance. In this specific case, I would strongly advise against using inheritance to arrive at a solution. What you are trying to do is take a sprite, which is naturally a rendering entity, and inject into it some methods and data for handling responsibilities outside its domain -- namely what sounds like AI ...


3

You could port the Box2D SVG parser implementation from the Box2D forums (you said that you have experience with AS3) . http://www.box2d.org/forum/viewtopic.php?f=8&t=3073 It doesn't look bloated to me.


3

To reduce the amount of if statements you have you need to make your solution data-driven instead of manually adding logic for each UI component that needs to interact. You could do this by storing your buttons data (such as each buttons bounding box and state) in an array of structs or a NSArray (or NSMutableArray) of classes. Then when you receive a touch ...


3

Sure, I had to figure that out for my game Star Catch. There may be better ways of doing it but this is how I did it. I actually found the algorithm online (sorry I can't remember the source) I did a search for detecting a point inside a polygon. I created a NSMutableArray to hold my point. I add the points in my touchevents. - (BOOL) ...


3

GameSalad is good for either quickly prototyping ideas, or if you want to develop an iPhone game on your own but don't know anything about programming. If however you have even a little familiarity with programming then GameSalad has many significant cons. The most significant con is that it is simply a very restrictive development tool; I haven't looked at ...


3

You could use something that someone has already created. http://ak.net84.net/iphone/creating-a-repeating-backgroundinfinite-parallax-effect-in-cocos2d/ It looks like the developer who wrote that ran into some troubles using the out of the box object as well and as such he decided to write a custom solution and subsequently share it with the world! Good ...


3

You seem to be worried about how to store your data when you should be concerned with the design of both your data, and how you expose it. Storing data in files or using a database is not a solution to design. Instead of a singleton, pass the data by reference into functions. It may make sense to use a hierarchy of data types, such as a planet type that ...


3

It's late in the day, but 71Squared has now released a command line app for Glyph Designer that allows you generate your font assets as part of your build process and also specify the size you would like, so you can automatically generate SD/HD output as required by your project. ...


3

Prediction is the way to go. It still works with 360° movement. All Quake games use it for example. The thing with prediction is that it fails as soon as the direction of movement of a predicted object changes (significantly). If this happens very frequently, prediction can't help you much. There is no other "magic" to fix latency, other than trying to ...


3

After hours of doing weird stuff (like creating an app that hides the window and terminates itself upon load just to make it appear like a command line app), it turns out the solution is too simple. Create that CCGLView yourself. Duh. Steps to create a skeleton cocos2d command-line application Xcode project: (Note: I'm using cocos2d 2.x, so if you're using ...



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