Get Updates By E-mail 

box2d

iPhone Game Physics Tutorial: Radial Gravity

  •  
  •  
  •  
  •  
  •  

Physics can be a great way to enhance your game.

The problem is that implementing physics in your game can be extremely challenging, but I found a couple of great examples showing how to enhance an iPhone or iPad game using radial gravity with Box2D.

The examples are from Nick Vellios, and as you can see in the example above they show how to implement radial gravity on an object so that other objects are drawn towards it (much like how planets are drawn to the sun).

The examples include:

How To Add Radial Gravity To Box 2D
Radial Gravity w/ Box2D SOURCE

And a third example on inverse radial gravity (think of objects exploding in all directions)
Bombs With Box 2D and Cocos2D

Cocos2D is used as the rendering engine in the examples.

By the way, can anyone remember the name of the nifty puzzle game that used radial gravity and won numerous indie gaming awards about 12 years ago? (yeah i’m stretching)

Thanks for reading, if you like this please share it!


  •  
  •  
  •  
  •  
  •  

Box2D iPhone Physics Tutorial – No Cocos2D Required

  •  
  •  
  •  
  •  
  •  

Box2D is a full-featured open source physics engine that has been used in many iPhone and iPad games.  It is often used with the excellent Cocos2D graphics engine.

Oliver Drobnik has created an excellent example of using Box2D with the UIKit.  This is a great example for those who are not familiar with, or don’t have any interest in using Cocos 2D.

[Source: Dr. Touch]


  •  
  •  
  •  
  •  
  •  

Great Free Tool For Easily Finding Vertex Locations Of 2D Sprites

  •  
  •  
  •  
  •  
  •  

If you’ve done any  2D action game programming you may have had to go through the tedious process of going through a collection of 2D sprites and finding and recording vertex coordinates around the game objects.

It’s a major hassle to do this by hand, and for me personally it’s things like this that hold me back from doing things, or sometimes taking an easier way out (like using box collisions or spherical collisions just so I don’t have to do this), but it’s a fairly quick process selecting things graphically with this program

Fortunately Johannes Fahrenkrug has created a very nice time saving tool for getting these vertex locations, see this video of it in action:

As you can see it can even print out formats specifically for Box2D and Chipmunk which is great for Cocos2D fans.

You can download the source here on git: VertexHelper with a full Xcode project for easy compilation on your Mac (sorry windows users).

[Source: Springenwerk Blog by Johannes Fahrenkrug]


  •  
  •  
  •  
  •  
  •  

How To Create A Breakout Game with Cocos2D and Box2D

  •  
  •  
  •  
  •  
  •  

An outstanding series of tutorials has been posted on how to use Box2D with Cocos2D,  and creating a simple breakout game using these technologies.

The tutorials are from Ray Wenderlich, the creator of the Space Game Starter Kit and co-author of the Learning Cocos2D book, and the first thing that you will want to do is check out Intro to Box2D with Cocos2D Tutorial: Bouncing Balls.  In this tutorial you’ll learn how to create a Box2D project, and how to add physical characteristics to 3D objects with Box2D.

Next you’ll want to check out How To Create A Simple Breakout Game with Box2D and Cocos2D Tutorial: Part 1/2, in this tutorial you’ll use what you learned in the first tutorial and in addition turn the ball into an ever bouncing ball, and add a paddle that you can move across the screen along with how to set up collisions between the two.

Finally, go through How To Create A Simple Breakout Game with Box2D and Cocos2D Tutorial: Part 2/2, and you’ll learn how to place blocks for the ball to hit, and how to set up collisions between the objects and finally an end of game screen.

[Source: Ray Wenderlich]


  •  
  •  
  •  
  •  
  •