开发者

How would one use Cocos2d to create a game like this

http://itunes.apple.com/us/app/angry-birds/id343200656?mt=8&ign-mpt=uo%3D6

So I am getting started with this all game dev thing on iphone and I decided that I will start playing with Cocos2d as my starting engine.

Now just so i have a goal in mind, I picked angry birds as my initial target of what sort of game play would I like to learn to build. This is not going to be a market release game. This is totally going to be learning purposes only.

So to start off my question is:

  • Would something like this be achievable using Cocos2d?
  • How would I go about building the physics for this?
  • How can one do a screen scroll like the way they do in cocos2d? (any example code would be great)

This is just to start off. If you have any particular questions please do add to this question.


Few more things that I am wondering about:

  • animated sprites. How does one create that? Is that a Cocos2d feature or i can use UIImageView?
  • drag and drop support. How do they detect that I am dragging the bird?
  • More of a graphics question: how do they animate the "band stretch" effect?

cheers


Progress

So i have been able to setup a world in Cocos2d along with box2d and now i have a few blocks that collide and simulate physics. Now I am having开发者_运维知识库 issues that I think can be resolved by further hints/help/tutorials.

  1. How do I make a sprite move in an arc? Like when u throw the bird it moves along a curve. How can I calculate that? where does that logic go? (built-in or needs to be coded?)

  2. How do I create a world (maps) where certain blocks are static and certain are breakable? Should I look into SVG support in cocos2d?

  3. How do I simulate collision like they do in angrybirds?

cheers.


  1. A game like Angry Birds is definitely possible using cocos2d.

  2. You should definitely use box2d or Chipmunk. I would recommend box2d, since I found it easier to understand. The basic idea is that you create a box2d body for each sprite, e.g. the birds and the pieces of the structure are all separate bodies.

  3. The basic idea is to create a layer that is bigger than the screen that contains everything and then move that layer around. To allow scrolling by touch, you would need to track how far the touch moves in the touch start/moved/finished methods and move the layer accordingly. You also might be able to use the CCFollow action to simulate a camera following the bird through the air.

Edit for your other questions:

  1. Sprite animations are handled using CCSpriteSheet. You can see more in the programming guide.

  2. You detect where you are dragging the bird by using the touch location, which is fairly straightforward when you write your touch methods. Again, refer to the programming guide.

  3. I'm not sure of the best way to stretch the band. One way would be to use several sprites (one for each side of the band, one for the 'pouch' in the middle) and strech/rotate them as needed.


How to make a game like Angry Birds?

you can ref in : http://goodsteven.blogspot.com/2010/10/how-to-make-game-like-angry-birds.html

BeBeWoo Lite tools/libs using:

  • Cocos2D for iPhone (0.99.4) ( ObjC )
  • Box2d ( C++ )
  • XML or PList for Level Data-
  • Level Editor ( include in Game or not )
  • Font Editor : Hiero
  • Sprite Editor : Zwopte


Some ideas:

  • It looks achievable in cocos2d.
  • cocos2d integrates with two physics engines: box2d and ChimpMunk. You should try one of those.
  • You can check samples (or docs) about parallax scrolling, to achieve some of the looks, and then check the touch management cocos2d provides.

As a side note, the guy who develops cocos2d sells the source code for Sapus Tongue (his game), which may turn useful for you to get started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜