
{"id":783,"date":"2009-01-15T09:00:32","date_gmt":"2009-01-15T08:00:32","guid":{"rendered":"http:\/\/www.matthijskamstra.nl\/blog\/?p=783"},"modified":"2009-02-14T14:53:14","modified_gmt":"2009-02-14T13:53:14","slug":"hello-box2d-part-4","status":"publish","type":"post","link":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/","title":{"rendered":"Hello box2D &#8211; part 4"},"content":{"rendered":"<p>In my <a href=\"http:\/\/www.matthijskamstra.nl\/blog\/index.php\/2009\/01\/13\/hello-box2d-part-3hello-box2d-part-3\/\">previous post<\/a> I update the &#8220;Hello world&#8221; for box2D so that you can see something visual interesting.<br \/>\nYou can find the original here: <a href=\"http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Hello_Box2D\">AS3: Hello Box2D<\/a>.<\/p>\n<p>Today I will post the same code but now how it should be.<br \/>\nKeeping the <a href=\"http:\/\/opensource.adobe.com\/wiki\/display\/flexsdk\/Coding+Conventions\">coding conventions<\/a> in mind and making it easier to reuse code.<\/p>\n<p>Still keeping in mind the original <a href=\"http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Hello_Box2D\">Hello world<\/a><\/p>\n<p>[as]<br \/>\npackage {<\/p>\n<p>\timport flash.display.*;<br \/>\n\timport flash.events.*;<br \/>\n\t\/\/ Box2D Classes used in this &#8220;Hello world&#8221;<br \/>\n\timport Box2D.Dynamics.*;<br \/>\n\timport Box2D.Collision.*;<br \/>\n\timport Box2D.Collision.Shapes.*;<br \/>\n\timport Box2D.Common.Math.*;<\/p>\n<p>\t\/\/[SWF(width=&#8221;640&#8243;, height=&#8221;480&#8243;, backgroundColor=&#8221;#000000&#8243;, frameRate=&#8221;60&#8243;)]<br \/>\n\tpublic class HelloWorld extends MovieClip {<\/p>\n<p>\t\tpublic var world:b2World;<br \/>\n\t\tpublic var iterations:int \t\t= 10;<br \/>\n\t\tpublic var timeStep:Number \t\t= 1.0 \/ 60.0;<br \/>\n\t\tpublic var worldScale:Number \t= 30.0;<\/p>\n<p>\t\t\/\/ to see what you have created<br \/>\n\t\tprivate var debugDraw:b2DebugDraw;<br \/>\n\t\tprivate var isDebugDrawing:Boolean = true;\t\/\/ change to false and there is no debugDraw<\/p>\n<p>\t\t\/\/ constructor<br \/>\n\t\tpublic function HelloWorld() {<br \/>\n\t\t\t\/\/trace( &#8220;HelloWorld.HelloWorld&#8221; );<br \/>\n\t\t\tinit();<br \/>\n\t\t}<\/p>\n<p>\t\t\/**<br \/>\n\t\t * lets start building our &#8220;Hello world&#8221; box2D program<br \/>\n\t\t *\/<br \/>\n\t\tprivate function init():void {<br \/>\n\t\t\ttrace( &#8220;HelloWorld.init&#8221; );<\/p>\n<p>\t\t\tcreateWorld();<br \/>\n\t\t\tcreatingGroundBox();<br \/>\n\t\t\tcreatingDynamicBody();<\/p>\n<p>\t\t\tsetupDebugDraw();<\/p>\n<p>\t\t\t\/\/ Add event for main loop<br \/>\n\t\t\taddEventListener(Event.ENTER_FRAME, onUpdateHandler, false, 0, true);<br \/>\n\t\t}<\/p>\n<p>\t\t\/**<br \/>\n\t\t * http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Creating_a_World<br \/>\n\t\t *\/<br \/>\n\t\tprivate function createWorld():void {<br \/>\n\t\t\t\/\/ Creat world AABB<br \/>\n\t\t\tvar worldAABB:b2AABB = new b2AABB();<br \/>\n\t\t\tworldAABB.lowerBound.Set(-100.0, -100.0);<br \/>\n\t\t\tworldAABB.upperBound.Set(100.0, 100.0);<\/p>\n<p>\t\t\t\/\/ Define the gravity vector<br \/>\n\t\t\tvar gravity:b2Vec2 = new b2Vec2 (0.0, -10.0); <\/p>\n<p>\t\t\t\/\/ Allow bodies to sleep<br \/>\n\t\t\tvar doSleep:Boolean = true;<\/p>\n<p>\t\t\t\/\/ Construct a world object<br \/>\n\t\t\tworld = new b2World(worldAABB, gravity, doSleep);<br \/>\n\t\t}<\/p>\n<p>\t\t\/**<br \/>\n\t\t * http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Creating_a_Ground_Box<br \/>\n\t\t *\/<br \/>\n\t\tprivate function creatingGroundBox():void {<br \/>\n\t\t\tvar groundBodyDef:b2BodyDef = new b2BodyDef();<br \/>\n\t\t\tgroundBodyDef.position.Set(0.0, -9.0);<\/p>\n<p>\t\t\tvar groundBody:b2Body = world.CreateBody(groundBodyDef);<\/p>\n<p>\t\t\tvar groundShapeDef:b2PolygonDef = new b2PolygonDef();<br \/>\n\t\t\tgroundShapeDef.SetAsBox(50.0, 10.0);<\/p>\n<p>\t\t\tgroundBody.CreateShape(groundShapeDef);<br \/>\n\t\t}<\/p>\n<p>\t\t\/**<br \/>\n\t\t * http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Creating_a_Dynamic_Body<br \/>\n\t\t *\/<br \/>\n\t\tprivate function creatingDynamicBody ():void {<br \/>\n\t\t\tvar bodyDef:b2BodyDef = new b2BodyDef();<br \/>\n\t\t\tbodyDef.position.Set(10.0, 10.0);<br \/>\n\t\t\tvar body:b2Body = world.CreateBody(bodyDef);<\/p>\n<p>\t\t\tvar shapeDef:b2PolygonDef = new b2PolygonDef();<br \/>\n\t\t\tshapeDef.SetAsBox(1.0, 1.0);<br \/>\n\t\t\tshapeDef.density = 1.0;<br \/>\n\t\t\tshapeDef.friction = 0.3;<br \/>\n\t\t\tshapeDef.restitution = 0.8;<br \/>\n\t\t\tbody.CreateShape(shapeDef);<br \/>\n\t\t\tbody.SetMassFromShapes();<\/p>\n<p>\t\t}<\/p>\n<p>\t\t\/\/ extra to visualize<br \/>\n\t\tprivate function setupDebugDraw():void {<br \/>\n\t\t\tif(isDebugDrawing) {<br \/>\n\t\t\t\tdebugDraw = new b2DebugDraw();<br \/>\n\t\t\t\tdebugDraw.m_sprite = new Sprite();<\/p>\n<p>\t\t\t\taddChild(debugDraw.m_sprite);<\/p>\n<p>\t\t\t\tdebugDraw.m_drawScale = 30;<br \/>\n\t\t\t\tdebugDraw.m_fillAlpha = .25;<br \/>\n\t\t\t\tdebugDraw.m_lineThickness = 1;<br \/>\n\t\t\t\tdebugDraw.m_drawFlags = b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit ;<br \/>\n\t\t\t\tworld.SetDebugDraw (debugDraw);<br \/>\n\t\t\t}<br \/>\n\t\t}<\/p>\n<p>\t\t\/**<br \/>\n\t\t * http:\/\/www.box2d.org\/wiki\/index.php?title=Manual\/AS3#Simulating_the_World_.28of_Box2D.29<br \/>\n\t\t *\/<br \/>\n\t\tpublic function onUpdateHandler(e:Event):void{<br \/>\n\t\t\tworld.Step(timeStep, iterations);<br \/>\n\t\t}<\/p>\n<p>\t} \/\/ end class<\/p>\n<p>} \/\/ end package<br \/>\n[\/as]<\/p>\n<p>So all you need to do is CTRL+ENTER.<\/p>\n<p>And you will have something like this:<\/p>\n<div class=\"flash\">[swf]http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/helloworldbox2d_nice.swf,520, 390[\/swf]<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post I update the &#8220;Hello world&#8221; for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,3],"tags":[408,230,231,398,159],"class_list":["post-783","post","type-post","status-publish","format-standard","hentry","category-as3","category-flash","tag-as3","tag-box2d","tag-box2dflash","tag-flash","tag-flashdevelop"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"In my previous post I update the &quot;Hello world&quot; for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Matthijs Kamstra\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"[mck] | a polymath zapper\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Hello box2D \u2013 part 4 | [mck]\" \/>\n\t\t<meta property=\"og:description\" content=\"In my previous post I update the &quot;Hello world&quot; for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2009-01-15T08:00:32+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2009-02-14T13:53:14+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Hello box2D \u2013 part 4 | [mck]\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In my previous post I update the &quot;Hello world&quot; for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#article\",\"name\":\"Hello box2D \\u2013 part 4 | [mck]\",\"headline\":\"Hello box2D &#8211; part 4\",\"author\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#organization\"},\"datePublished\":\"2009-01-15T09:00:32+01:00\",\"dateModified\":\"2009-02-14T14:53:14+01:00\",\"inLanguage\":\"en-US\",\"commentCount\":3,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#webpage\"},\"articleSection\":\"AS3, Flash, AS3, box2d, box2dFlash, Flash, flashdevelop\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/#listItem\",\"name\":\"Flash\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/#listItem\",\"position\":2,\"name\":\"Flash\",\"item\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/as3\\\/#listItem\",\"name\":\"AS3\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/as3\\\/#listItem\",\"position\":3,\"name\":\"AS3\",\"item\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/as3\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#listItem\",\"name\":\"Hello box2D &#8211; part 4\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/#listItem\",\"name\":\"Flash\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#listItem\",\"position\":4,\"name\":\"Hello box2D &#8211; part 4\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/category\\\/flash\\\/as3\\\/#listItem\",\"name\":\"AS3\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#organization\",\"name\":\"[mck]\",\"description\":\"a polymath zapper\",\"url\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Matthijs Kamstra\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/06ff22a1197b6624946e5a3377184f11ddc00ac06a6f1d2311b9d2072bdf61b1?s=96&d=wavatar&r=g\",\"width\":96,\"height\":96,\"caption\":\"Matthijs Kamstra\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#webpage\",\"url\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/\",\"name\":\"Hello box2D \\u2013 part 4 | [mck]\",\"description\":\"In my previous post I update the \\\"Hello world\\\" for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/2009\\\/01\\\/15\\\/hello-box2d-part-4\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2009-01-15T09:00:32+01:00\",\"dateModified\":\"2009-02-14T14:53:14+01:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/\",\"name\":\"[mck]\",\"description\":\"a polymath zapper\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.matthijskamstra.nl\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Hello box2D \u2013 part 4 | [mck]","description":"In my previous post I update the \"Hello world\" for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still","canonical_url":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#article","name":"Hello box2D \u2013 part 4 | [mck]","headline":"Hello box2D &#8211; part 4","author":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/#organization"},"datePublished":"2009-01-15T09:00:32+01:00","dateModified":"2009-02-14T14:53:14+01:00","inLanguage":"en-US","commentCount":3,"mainEntityOfPage":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#webpage"},"isPartOf":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#webpage"},"articleSection":"AS3, Flash, AS3, box2d, box2dFlash, Flash, flashdevelop"},{"@type":"BreadcrumbList","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.matthijskamstra.nl\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/#listItem","name":"Flash"}},{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/#listItem","position":2,"name":"Flash","item":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/#listItem","name":"AS3"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/#listItem","position":3,"name":"AS3","item":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#listItem","name":"Hello box2D &#8211; part 4"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/#listItem","name":"Flash"}},{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#listItem","position":4,"name":"Hello box2D &#8211; part 4","previousItem":{"@type":"ListItem","@id":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/#listItem","name":"AS3"}}]},{"@type":"Organization","@id":"https:\/\/www.matthijskamstra.nl\/blog\/#organization","name":"[mck]","description":"a polymath zapper","url":"https:\/\/www.matthijskamstra.nl\/blog\/"},{"@type":"Person","@id":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/#author","url":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/","name":"Matthijs Kamstra","image":{"@type":"ImageObject","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/06ff22a1197b6624946e5a3377184f11ddc00ac06a6f1d2311b9d2072bdf61b1?s=96&d=wavatar&r=g","width":96,"height":96,"caption":"Matthijs Kamstra"}},{"@type":"WebPage","@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#webpage","url":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/","name":"Hello box2D \u2013 part 4 | [mck]","description":"In my previous post I update the \"Hello world\" for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/#breadcrumblist"},"author":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/author\/admin\/#author"},"datePublished":"2009-01-15T09:00:32+01:00","dateModified":"2009-02-14T14:53:14+01:00"},{"@type":"WebSite","@id":"https:\/\/www.matthijskamstra.nl\/blog\/#website","url":"https:\/\/www.matthijskamstra.nl\/blog\/","name":"[mck]","description":"a polymath zapper","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.matthijskamstra.nl\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"[mck] | a polymath zapper","og:type":"article","og:title":"Hello box2D \u2013 part 4 | [mck]","og:description":"In my previous post I update the &quot;Hello world&quot; for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still","og:url":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/","article:published_time":"2009-01-15T08:00:32+00:00","article:modified_time":"2009-02-14T13:53:14+00:00","twitter:card":"summary_large_image","twitter:title":"Hello box2D \u2013 part 4 | [mck]","twitter:description":"In my previous post I update the &quot;Hello world&quot; for box2D so that you can see something visual interesting. You can find the original here: AS3: Hello Box2D. Today I will post the same code but now how it should be. Keeping the coding conventions in mind and making it easier to reuse code. Still"},"aioseo_meta_data":{"post_id":"783","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-12-11 08:59:30","updated":"2025-06-04 09:24:32","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.matthijskamstra.nl\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/\" title=\"Flash\">Flash<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/\" title=\"AS3\">AS3<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHello box2D \u2013 part 4\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.matthijskamstra.nl\/blog"},{"label":"Flash","link":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/"},{"label":"AS3","link":"https:\/\/www.matthijskamstra.nl\/blog\/category\/flash\/as3\/"},{"label":"Hello box2D &#8211; part 4","link":"https:\/\/www.matthijskamstra.nl\/blog\/2009\/01\/15\/hello-box2d-part-4\/"}],"_links":{"self":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/comments?post=783"}],"version-history":[{"count":4,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/783\/revisions"}],"predecessor-version":[{"id":869,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/783\/revisions\/869"}],"wp:attachment":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/media?parent=783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/categories?post=783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/tags?post=783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}