Problem in using CCCamera - iphone

I am going to work on a game project. I am using cocos2d. I want to use cccamera class of cocos2d. Please tell me about any tutorial on cccamera. I want to implement more or less like angry birds, throwing the ball that reaches its destination facing the obstacles in the way.
So when the ball moves ahead the scene accordingly moves back depending on speed of the ball.
How to manage all that. I think i should use cccamera.
Thanx.

CCCamera, per the documentation is used for 3D effects (http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_c_c_camera.html) and recommends the use of CCFollow (http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_c_c_follow.html) for 2D related effects (such as following the birds forward, etc).

Related

Simple Cocos2d Iphone Game. Just some basic questions

I'm making an app, where the sprite has to run across the screen pressing buttons and jumping and ducking. Kind of like line runner. Anyways, I'm using cocos2d. Is this what i should be using. If it is, how would i make it. Im not asking for all the code, just the basic objectives and what i should do! thanks so much!
Cocos2d is one of the best platform to make game i think what you want to do can be done by cocos2d and you need to know how to move object(sprite) across the scene and how to detect the collation.
there is lots of way to move the sprite across the screen you can also move then by the cocos2d built in methods.
search for move method which will help you.
I would definitely advise you to use Cocos2d for this purpose and also Box2d if you need real physics simulation in your game.
Regarding of writing your game have a look here : It contains very useful cocos2d tutorials and even have a tutorial of how to write a full functioning game (Look for the monkey game)
Note : It seems that the link does not work right now but I am sure it will be fixed soon..

Which to use when - COCOS2d or simple UIImageView with animation?

I am going to create simple iPad game, in which arrow going to hit balls. Where balls are moving in random direction with random speed. When arrow hits ball there is blast like animation with sound (Collision detection is main thing here). So for this what should i prefer. Should I use simple UIImageView and animation or use COCOS2D. Also I am new to COCOS 2d. Any other options are also appreciated. Thank You.
Use cocos2d Animation .Refer below link
if u have spritesheets try this:
1) http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d
or u have separate images refer this:
2) http://cocos2d-iphone.org/wiki/doku.php/prog_guide:animation
Using cocos2d has a lot od advantages over UIKit. One of the things is box2d which will be very helpful for game like this [at least I got this impression for your question].
Do some research about box2d collision detection.

Iphone game cocos2d and box2d

I have image named "platform.png" that represents one brick for platform of a IPhone game. I have a cartoon character that will jump on this platform.
A series of platform.png will form one complete platform. These series will be generated by swiping finger across Iphone screen. When character will jump on this platform it should go down like elastic and bounce back up. Can anyone tell me how to do this ?
Thanks in advance.
What yo want is Collision Detection. I don't think using Cocos2d will be a great idea to use in this case because you want to show elastic and bounce effects which should seem real. For this, what I suggest, is using Box2d which clearly help in showing the effects in a natural way. Here Collision Detection can be handled in a separate class known as ContactListener. You can study Box2d and ContactListener here. In ContactListener you can generate these effects and this class is very easy to handle. Two or three months back I used the same to create my game Pogo Jump and believe me I was very easy to work on Box2d.
Good luck..!!
heye ,
you have two options for this , either use box-2d/chipmunk or dont.
If you have prior experience with Physics then i would say box-2d/chipmunk would look more realistic.

Simple iPhone accelerometer ball-maze game

I want to make a simple 2D game where the user has to navigate a ball through a maze (using the accelerometer of course). I used a simple view to make use of the accelerometer and move a ball on the screen. Now how do I go about building the maze? Would I have to use cocos2d or something similar? How do I make the ball stop or rebound when it hits the wall of the maze?
Check out this game... it does a great job with the accelerometer and also setting boundaries.
http://github.com/haqu/tweejump
This one is for Android rather than iPhone, but it has some parts that are very relevant to your project, such as moving a ball. Does not include ball rebounding or building a random maze; it loads mazes from a file.
Amazed
For ball/wall bouncing, try this question.
For generating a maze, see this question.

iPhone: Camera following player in cocos2d

I'm making an iPhone game in cocos2d.
I was wondering how I would make the camera / the view follow a specific sprite?
would I use the CCCamera class?
Yes, CCCamera would work. However, it has some drawbacks that make it undesirable for some uses. Moving the layers respectively all other objects relative to that sprite may be a better solution. It depends on the game.
First, read up what the different approaches and their drawbacks are, you can get a lot out of this cocos2d forum thread:
http://www.cocos2d-iphone.org/forum/topic/5363
It would be helpful if you could describe what your game is about and why you need the camera attached to that sprite.
For example, if you're thinking of a running game like Canabalt, i would not use the camera to scroll over the world, but instead scroll everything relative to the player (towards him) with the player sticking at about the same x coordinate while running. Perfect examples of games where you would not move the camera at all are the iCopter games, they are basically simplified versions of Canabalt. Notice that the player sprite always stays at the exact same x coordinate, and the game world just scrolls
Scrolling the camera itself in my opinion makes the most sense if you have a large game world that the player can traverse in all directions, and the number of objects are simply too numerous and also moving about in various directions, so updating their positions individually each frame would be both overkill and prone to errors. And since the game world is so huge, you would want to use the camera's position to limit what is drawn on screen.
use CCFollow actions
Like these :-
[self runAction:[CCFollow actionWithTarget:(u r hero) worldBoundary:CGRectMake(0,0,1050,350)]];
it will helps