Archive for August 2014


Joe’s Internet This Week – 1

Random reports from screwing around on the internet:

  1. There exists video of M. C. Escher creating his last major woodcut, Snakes: link. I haven’t figured out where this video comes from or why it doesn’t have sound. The camera movement and so forth make it seem like it isn’t a home movie — so I’d like to know more about the source material.
  2. H. G. Wells wrote two books of rules for playing what we would now call strategy games using tin soldiers as game pieces: Floor Games and Little Wars. The complete text of both is available online at Project Gutenberg. Gary Gygax wrote the forward to a 2004 edition of Little Wars.
  3. The complete text of the screenplay to the 1961 movie The Hustler is available online. Regarding the line from The Hustler, “J. T. S. Brown, no ice, no glass”, J. T. S. Brown bourbon exists and is still produced.
  4. Apparently Apple was still selling HyperCard all the way into 2004 … Maybe it is just my old guy view of the world– because I now divide time into a vague extended present which includes 2004 and a vague personal olden days which includes things like HyperCard — but I find this somewhat incredible.

Cocos2d-x + Box2d Breakout Updated

Cocos2d-x releases since version 3 have broken compatibility with old tutorials. This can especially be a problem when you want to do something slightly non-standard from the point-of-view of Cocos2d-x.

If you want to use physics in a Cocos2d-x game the current standard way to do this is to use the integrated physics classes, which are Chipmunk-based by default and can use Box2d too in some hybrid way the details of which are not at all clear. However,  in my case I want to use Box2d, period, Box2d in a non-integrated manner for transparency and in order to leverage the vast amount of code that you get to peruse and possibly use by writing to vanilla Box2d. When doing something like this it can be hard to know where to start given that any sample code you find will be broken.

For setting up a Box2d/Cocos2d-x project there was always this BreakOut implementation to Cocos2d-iphone by Ray Wenderlich, link, which is transliterated into Cocos2d-x here but to relatively ancient versions of both Box2D and Cocos2d-x. I’ve taken that code and updated it to Cocos2d-x version 3.2 and Box2d version 2.3.

Here is my updated version.

To use do the following:

  1. Setup a cocos2d-x v3.2 project via the python script. This will give you Box2d v2.3 set up in your project without you having to do anything else.
  2. Copy the source code in the above zip file into your project’s Classes directory.
  3. Copy the image files the Ball.jpg, Block.jpg, and Paddle.jpg from here into your project’s Resources directory.
  4. Build.

(You can copy over the music/sound files too. I have the relevant calls commented out in the code above)