Demo & Source: Simple Box2D, with curved edges!

 

(The image above this text is actually the Flash movie, if you hadn’t guessed.  Try using your mouse to interact.  If it’s blank, then something’s gone wrong!)

I’ve been busy working on my Box2D classes again. (As before here and here.)  I’m not quite ready to go through the code with some tutorials yet, but you can download the source for this demo here.  This version has had a bit more of a proper code cleanup – I’ve un-hacked some hacks I did earlier in development, and added a few more utility functions, but most importantly this version supports SWF library asset importing of multiple shapes, and shapes with curved edges (which it couldn’t do previously).

I feel like I should put that in bold or something, because it’s probably my most-clever bit of code to date.  I’m going to settle for saying it twice though: You can import library objects with multiple shapes, and shapes with curved and straight edges.  Have a look at the screenshot below and compare it with the Box2D display;

In Flash IDE:

In Box2D:

You can download the source for this demo here.

I’m going to get this as a project on some publicly-available source repository soon.  I’d love to hear feedback on it now though!

,

About James

James is a Senior New Media Developer at MMT Digital, and has BA(Hons) in Design for Interactive Media from the University of Gloucestershire. He loves designing and producing all sorts of website and Flash-related things, as well as prattling on about technologies.Day-to-day he works with Flash, Dreamweaver, Director, Microsoft Office Sharepoint Server 2007 (MOSS) and in his spare time he mucks about in Flex and Wordpress.Follow James on Twitter.

7 Responses to “Demo & Source: Simple Box2D, with curved edges!”

  1. reyco 14th January, 2010 at 4:10 pm # Reply

    Looking real good James! Nice Job!!

  2. chichlatte 4th March, 2010 at 5:32 pm # Reply

    Just superb. Makes box2d something you can play with rather than wrestle with. I’m going to build something fun with this as soon as i get a minute :)

  3. James 5th March, 2010 at 12:25 am # Reply

    Let me know how you get on! The latest post on this is here and the source code is also available from GitHub here.

  4. T 23rd March, 2010 at 1:08 pm # Reply

    outstanding! I may branch out an update for 2.1a if it’s not already in the works in a month or two.

  5. James 24th March, 2010 at 11:53 pm # Reply

    @T I’m not currently updating things to the 2.1 version myself, so please feel free to branch things!

  6. Lavon Woods 19th June, 2010 at 2:27 am # Reply

    Awesome post man, I borrowed your idea of importing assets from the flash IDE and integrated into my soon to be released Isometric component. http://hybridmindset.com/blog/My-PushButton-Engine-Experience-Week-2

  7. James 21st June, 2010 at 9:13 am # Reply

    Sounds like a cool idea Lavon!

Leave a Reply

Note: This post is over 2 years old. You may want to check later in this blog to see if there is new information relevant to your comment.