We’re rewarding the question askers & reputations are being recalculated! Read more.
27

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


9

The flick gesture is managed in two separate step: detection and conseguent dynamics. Flick Check The first one is the toughest. Basically you have to collect points in time and space when the touch starts as the touch moves. When the touch ends you have to look to what you gathered to see if there were a Flick. A simple flick check can be done by looking ...


9

You could go for a linked list, as others suggested. But basically, a snake is just a FIFO stack (sometimes called a queue) of grid coordinates: When the snake grows one bit, you just push an element on top of the stack When it moves one square, you push an element on top and pop an element off the bottom For an implementation of a queue in Objective-C, ...


8

Am I hurting myself by learning C++ before... No, C++ is a good way to learn about all the basics of programming, including Object Oriented programming, and memory management which might be handled for you in other languages. There's got to be a reason the university requires C++ It is an industry standard across the world. It is quite portable as there ...


8

Ok, after reading a lot i've found the solution: Seems that the extern call don't work inside the editor or simulator, so the correct way of doing this is develop for device (after putting the header and the implementation files under Assets/Plugins/iOS). I hope that this will help some one :)


8

You could think of individual places as "rooms" with "doors" connecting them: To implement this, you could create a struct Room to hold a room, with fields for a set of items currently in it and what directions its exits lie in. Then simply keep an array of all rooms and have a pointer to the one the player is currently in. There are ways of getting extra ...


8

This is a very interesting topic. You can build the water effect using SpriteKit and its integrated physics engine. Step 1 Create a Physics World Create many little circular SKSpriteNode(s), each one will have a circular physics body matching the graphics representation Step 2 Then every frame you'll need to: Draw all the sprites on a buffer Apply a ...


7

Xcode can indeed be used to create games. You can do anything a Mac/iOS device is capable of by programming in Xcode. I think you should focus on what part of the project you want to focus on. As you state you are a brand new Objective-C programmer (welcome). In my opinion it would be quite a mouth full to try and just into Objective-C programming whilst ...


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


7

You're not hurting yourself because you're doing what is required by your school. Learning to program is only partially about learning the syntax of a specific language (and it's a small part!). Right now you're learning to think logically and like a programmer. Don't worry about learning things you don't need, because it's all useful in some way.


6

If you can detect the user tapping on the screen, and know how to draw a simple textured 'quad' (two textured triangles or a triangle strip/fan) then the simplest button is just a combination of the two. Draw a quad on the screen, texture it with your button's image, then do a simple bounding box test to see if the user has tapped inside it. Be careful ...


6

If you'd like to learn Objective-C, I suggest you have a look at cocos2d. It's an open-source 2d engine (written in Objective-C) that allows you to write games for iOS or Mac OS using XCode. It's not as easy to create games with as with a package like Unity, but there are lots of tutorials (and even books) for cocos2d to be found. A good place to start ...


6

The "worth" of something can only be determined by you. For some people it isn't worth porting to android for the amount of time spent vs. sales. That being said there's no reason to just use C++ for everything. Sure, the interfaces for certain things is C or Objective-C, but you can call both of those easily from C++.


6

You need to reparamaterize the curve. The easiest way to do this is to calculate the arc lengths of several segments of the curve and use these to figure out where you should sample from. For example, maybe at t=0.5 (halfway through), you should pass s=0.7 to the curve to get the "halfway" position. You need to store a list of arc lengths of various curve ...


6

Your question is a good one. I've had exactly the same question regarding SpriteKit and have been very confused about the lack of information on the web about this. SpriteKit seems to encourage you to put all of your Model-View-Controller code into the same class (your SKScene subclass), which is really confusing to me. How would you ever build a game of ...


5

What can affect the movement of the puck? Is this pong? In any case, I would recommend a different synchronization technique. I would send three pieces of information from the server to the client: Position Velocity Magnitude and Direction Time on a shared clock The shared clock can be done many different ways, and it could depend on the language you are ...


5

Absolutely! XCode is the standard programming IDE for the Mac and iOS. So if your goal is making a game for iOS, you will probably be using XCode along with a few other helping technologies of your choice (e.g. OpenGL ES 2.0). But since you mentioned game engines I'd also recommend you to use one, since they'll save you a lot of time and effort: If you are ...


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

Looking at the art assets in your github I think I know what the problem is. What you need is alpha blending. Save your sprites with an alpha channel (or convert the background to zero alpha when loading the textures). Set up blend function like this: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); That tells OpenGL to blend (mix) the pixel data that'...


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

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


4

As @slf commented any C/C++ code can be compiled for iOS devices. so you can use any of these libraries: dlib is a library which has many useful tools including machine learning. MicroPather is a path finder and A* solver (astar or a-star) written in platform independent C++ that can be easily integrated into existing code. Here is a list of some AI ...


4

On iOS 5 Cocos2d uses the CADisplayLink (Apple's doc). It' a timer object that allows synchronizing your application's drawing to the refresh rate of the display. Cocos2d has a class which receives all dispatches from CADisplayLink. It calls drawScene on the director class which then calls the scheduler's tics method (which notifies the timers which need ...


4

I've seen the comment of Byte56, but the links there don't provide the exact answer, or aren't graphically detailed for this specific task, so if it's an answer the user wants, why not let him have one. Here goes. Imagine you're flying over the ground (the xy plane) and your ship's orientation is known (the green camDir vector). You want your camDir to ...


4

You can change the size of a sprite like so: [mySprite setScaleX: newWidth/mySprite.contentSize.width]; [mySprite setScaleY: newHeight/mySprite.contentSize.height];


4

Ok, let's go at this in a multi-stage fashion: Room representation Before we can do anything else, we need to consider how to represent the rooms internally. This is just a rough thumbnail sketch, refine as necessary: @interface TARoom : NSObject { NSDictionary *_links; // Contains neighbouring rooms. NSString *_identifier; // This will become ...


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


4

One method is to have the head define a trail as it moves and position all other nodes at positions along this trail. In this method you need to define the position of the body parts as a constant distance along the snake from the head. So on each frame you want to; update the position of the head. add the current position of the head to a list of ...


3

What you can do is get all the children in the current layer and then iterate through then and use the CGRectIntersectsRect function to check if the any node is present at your desired location. After that you can do what ever you want to do with the nodes that are present at that frame. You need to get all the nodes like this CCArray *childrenNodes = [...


3

The UIGestureRecognizer might be something you can use. There are subclasses for many different gestures.


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