Talking about Actionscript 3, Box2D and Flash.
I already showed you two ways of editing Box2D environments with Bison Kick and simply using the Flash IDE.
Today I’ll show you the most advanced editor at the moment: World Construction Kit made with Box2D C++ 2D physics engine compiled with Adobe Alchemy.
The demos on the official site are really awesome and the creators say “World Construction Kit is is a toolset / framework for rapidly developing physics based games / websites within the Flash IDE. WCK allows you to layout your 2d worlds / game levels entirely within Flash and have them hook into the physics simulation without writing any code.”
Obviously you’ll have to write (more than) some code to mak a complete game, but at the moment let me show how to create a World Construction Kit (WCK from now on) “Hello World”.
The following project is almost the same you can create from the official step by step guide, just better explained with images.
1) Create a new Flash file, save it on your computer and in the same path create a folder called wck-lib
which will contain Box2D
, Box2DAS
, extras
, gravity
, misc
, shapes
and wck
folders of the package you can download fromthe official site.
2) In your Publish Settings select Flash
and check Export SWC
, then click Settings...
, set wck.WCK
as your Document class and in your Source Path include the wck-lib
folder you created in step 1.
Then move to Library path label and include Box2DAS/Box2D.swc
file from the folder you created in step 1.
Now draw a square on the stage and convert it to Symbol. Check Export for Actionscript
and set its Base Class as shapes.Box
In your library window, locate the square Symbol, right click on it and select Component Definition...
then set Class as wck.BodyShape
.
Back to the stage, select the square and convert it again to Symbol. This time the Base Class will be wck.World
.
Now with a double click on the square, you will be able to work with the Symbol. Select it and go to Component Inspector window. You will be able to set all its Box2D attributes.
Doing a couple of times this stuff, I managed to create a draggable dynamic little square over a large static square which acts as floor.
Download the source code with all required libraries.
Next time I’ll show you how to create a basic platform game.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.