Learn cocos2d 2: Game Development for iOS
Open Preview See a Problem?
How To Make A Simple iPhone Game with Cocos2D 3.0 Tutorial
Thanks for telling us about the problem. Return to Book Page. To see what your friends thought of this book, please sign up. Lists with This Book.
This book is not yet featured on Listopia. Oct 28, Andrew rated it liked it. This book and the code distributed with it are more and more out of date. I'm not really a developer anymore but I think in future I will read computer books within months of them coming out or not at all. Steffen has a new book coming out and there are a lot of online resources to learn iPhone programming.
I'm old fashion in that I like to have a book to stick on a shelf at the end I guess.
- Dating Breakthrough! An Interactive Guide to Create the Relationship You Want.
- See a Problem??
- Learn cocos2d 2 Game Development for iOS by Steffen Itterheim?
- How To Make A Simple iPhone Game with Cocos2D 3.0 Tutorial.
- Learn cocos2d 2: Game Development for iOS!
- Love Never Ends: Book One of the Festival Series;
- 買這商品的人也買了...?
Shayne Meyer rated it liked it Jun 26, Henrique rated it liked it Nov 27, One year manufacturer warranty on all major appliances. Not as described or damaged: All on line purchases must be handled through the website. We do not ship to the following locations: Most orders will ship next business day, provided the product ordered is in stock.
Orders are not processed or shipped on Saturday or Sunday, except by prior arrangement. The HelloWorldScene templates already comes touch enabled as you saw in the init method.
Cocos2D vs Sprite Kit
To handle these touches you typically need to create a touchBegan: So you have a ninja, monsters and projectiles flying all over the screen. It looks good but it would be a lot more fun with a bit of impact , for that you need collision detection between your projectiles and your monsters. One of the great new features of Cocos2D 3. Physics engines are great for simulating realistic movement, however they are also very useful for handling collision detection. You are now going to use the Cocos2D physics engine to determine when monsters and projectiles collide.
There are four steps to do this:. First, you will now need to add another private instance variable for you physics world. Ensure you have HelloWorldScene.
Learn cocos2d 2 Game Development for iOS
Now you need to setup the physics simulation and add it to your scene, add the following code after the CCNodeColor in the init method. Gravity is set to 0,0 as you are using the physics simulation primarily for collision detection. Cocos2D has some handy debug functionality, the debugDraw flag is really useful to help visualise your physics world. You will be able to see any physics bodies added to the simulation. You are also setting the collisionDelegate to self , this allows you to add collision Handlers to the scene and the physics simulation knows to look in HelloWorldScene for these handlers.
You will notice that Xcode will throw up a warning around the collisionDelegate line; this is easily resolved.
How To Make A Simple iPhone Game with Cocos2D Tutorial | www.newyorkethnicfood.com
You have setup physics simulation and created a player physics body and added it to the simulation. Now see if you can do this yourself, by adding the monster to the physics simulation. You are nearly there now! This time, see if you can add the projectile to the simulation. There is of course a method you can use to create a circular body shape bodyWithCircleOfRadius: Replace the projectile body code with the following:.
By default the center point will be at the bottom left of the sprite however you want the circle to be placed in the middle of your sprite.
Great, you have now modified your game objects to be part of the physics simulation. Now you really want to be able to execute some of your own code when the projectileCollision and monsterCollison collisionType make contact. The Cocos2D physics engine has some really nice functionality to do this. Just add the following method into HelloWorldScene. That snippet of code is pretty powerful.