iOS - Cocos2d, Box2d or Chipmunk - ios

I have to develop an app which has on screen 10 balls. When user shake the phone a sound will play and the ball have to move around the screen colliding each others without go out of bounds. I think i have to use cocos2d, box2d or chipmunk, but i don't know how can i do a thing like that. If someone have a tutorial, or some code it will be very appreciated.
I found another method that could be useful, it's CGRectIntersectRect(obj1.frame, obj2.frame)
but i think it isn't the correct way for my problem, is it right?
Thanks

Box2d or Chipmunk are supposed to take care of the collisions, so you don't have to use functions like CGRectIntersectRect to handle these kinds of events.
Start with some cocos2d tutorials to see how to display sprites on the screen and after that see some tutorials for your physics system of choice.

Box2d and Chipmunk are physics engines that come WITH cocos2d, cocos2d is the graphics engine.
I suggest you go for Box2d as it not only provides collision detections (including with circle body shapes for your case) but also lets you handle all the physics etc. I've never used Chipmunk.

There is a short Objective-Chipmunk tutorial that does most of what you are looking for already:
http://chipmunk-physics.net/tutorials/SimpleObjectiveChipmunk/

Related

Making a Platform game with Corona SDK

I'm trying to develop a platform game similar to Geometry Dash but i'm facing a lot of problems during the making of the algorithm.
I don't barely know how to proceed. Are the levels structured with a long image ( that is the ground) with obstacles added, or there are many obstacles generated progressively during the game?
I'd like to know where to start from, what to draw and how to place it in my game, how to build the collision detection.
The game will be an auto-scrolling platformer, so, will the character's asset be moving right or will all the level except for the character be moving left?
I'm a beginner, so i would like to receive detailed answers and not too difficult to understand. Thank you.
if you have any advice I would gladly listen to it.
I've done all corona tutorials but they doesn't explain how to do a platformer. - Luca Pasini
Looks like you still don't feel how game work from inside. Tutorials probably will not help you much. I think you need to start something very simple by your own - not by tutorials.
For example:
Show red rectangle
Show blue recatngle
Tap on the screen and red rectangle must change his position (not by transitions - just by core x,y change)
If they are collide - show text: "You win". Collision check just by raw calculations.
Then go with updates, that will make it looks more like a game.

SpriteKit: Should I pan the camera or move the background?

When building a game with SpriteKit, with a platformer game (like Doodle Jump for example), is it preferable to move the camera up, or the background nodes down ?
What is the standard practice in other frameworks ?
MOVE THE CAMERA!!!
One of the weirdest things about 2D game engines is that it often takes them a series of versions to get a camera.
They should be born with them.
SpriteKit was no different, it took forever to get a camera.
Now that it has one, never ever think of not using it.
Will make your life a million times simpler.
I can think of no exceptions, but look forward to being proven wrong.
move background was HOTFIX until proper cam support added.
use the cam. its easy and fun. no reason to not imo.

How to draw lines on the screen for an iOS game

I am working on a game where I need to draw a bunch of lines to create a wireframe sort of object, I can do this in sprite kit using nodes but adding a bunch of nodes to the screen will drop the frame rate down a lot. I don't know how to use OpenGL Es at all so that's not an option for me. Is there anything that would just allow me to draw lines on the screen in Sprite kit without adding nodes or is there another framework that will allow me to do that?
If you want a 3D wireframe then your choices are sprite kit (which is built on top of OpenGL), OpenGL, or Metal. Or I guess you could use somebody's 3rd party framework that is also built on top of OpenGL or Metal.
I tend to agree with nhgrif's comment that you're "I don't know xyz so I can't do that" is needlessly limiting. If you can't do anything that involves learning new APIs then you're never going to get very far as a developer.

Physics engine or not for making a Pendulum in iOS?

I'm trying to replicate the pendulum effect as seen in the old game "Gold miner", if you ever played it before. Do I need to use a physics engine for that, or not? I heard that Box2D is preferred over Chipmunk when it comes to ropes, but do I really have to join two objects together with a rope to accomplish this pendulum effect? I'd love to do it without a physics engine, but if I have to use one I think I would pref chipmunk as it comes with Cocos2d v3. (In short, whats the best way of making a pendulum that swings forever and can be lowered and raised)
Im' a complete n00b when it comes to physics engines, never used one before, only made non-games apps before :/ Any help is very appreciated =)
You mean the grappling hook in that game? That's absolutely not physics, or at least can be done easily without a physics engine. At best you may want to use the physicss engine's raycast collision detection methods (if any).

calculating force, velocity and distance in chipmunk

I am newbie with Cocos 2D, Chipmunk and Box 2D.
I have started basic docs and started to develop games.
Currently I am working with chipmunk.
I stuck at few points And they are as follow.
In my application, there is a player Who kick the soccer ball and ball will move to distance according to force applied by kick of player.
I am confused for ..
How do I make players whole body static and can make his one lag moveable to let it kick the ball.
How do I calculate force and vector and distance etc.
How do i move to next screen if my ball goes to out of current screen.
Please let me know the url from which I can easily get all type of examples for chipmunk application.
First off, you should learn chipmunk first and then try to solve your problem. I see a lot of people just wanting their problem to go away without actually making an effort to solve it. Here's some google results on Chipmunk tutorials.
https://www.google.co.cr/webhp?sourceid=chrome-instant&ix=sea&ie=UTF-8&ion=1#sclient=psy-ab&hl=en&site=webhp&source=hp&q=chipmunk%20tutorials&oq=&aq=&aqi=&aql=&gs_l=&pbx=1&fp=37838802d5e34660&ix=sea&ion=1&bav=on.2,or.r_gc.r_pw.,cf.osb&biw=1680&bih=882
About the 3 questions:
If you learn chipmunk or box2d, you can easily go and test different settings, from static bodys to joints to density. Depending on what you want to do, the solution differs. I suggest you look into that.
You can use several functions on each body you register. For box2d, youd use body->getAngle(), body->getLinearVelocity(), and body->getPosition(). With these 3 functions you can calculater force, vector and distance from every object. Im pretty sure chipmunk has something like this.
Really?? PSEUDOCODE: if (ball.position OUTSIDE screen.bounds) nextLEVEL();

Resources