

JS Functions Function Definitions Function Parameters Function Invocation Function Call Function Apply Function Bind Function Closures

JS Objects Object Definitions Object Properties Object Methods Object Display Object Accessors Object Constructors Object Prototypes Object Iterables Object Sets Object Maps Object Reference Loader-> loadJsonScene( "file.JS Tutorial JS HOME JS Introduction JS Where To JS Output JS Statements JS Syntax JS Comments JS Variables JS Let JS Const JS Operators JS Arithmetic JS Assignment JS Data Types JS Functions JS Objects JS Events JS Strings JS String Methods JS String Search JS String Templates JS Numbers JS BigInt JS Number Methods JS Number Properties JS Arrays JS Array Methods JS Array Sort JS Array Iteration JS Array Const JS Dates JS Date Formats JS Date Get Methods JS Date Set Methods JS Math JS Random JS Booleans JS Comparisons JS If Else JS Switch JS Loop For JS Loop For In JS Loop For Of JS Loop While JS Break JS Iterables JS Sets JS Maps JS Typeof JS Type Conversion JS Bitwise JS RegExp JS Precedence JS Errors JS Scope JS Hoisting JS Strict Mode JS this Keyword JS Arrow Function JS Classes JS Modules JS JSON JS Debugging JS Style Guide JS Best Practices JS Mistakes JS Performance JS Reserved Words Loader-> setOffset(x, y) // to translate world make sure to add your resources folder (folder containing json file) to cocos2dx search path cocos2d::FileUtils::getInstance()->addSearchPath( "your_folder ") īox2dWorldLoader *loader = new Box2dWorldLoader() Currently there are loaders available for LibGdx(Java), Box2d-Web(Javascript), Cocos2d-x (c++), Apple's Sprite Kit (objective-c) and Unit圓D in /resources/loaders folder To use Cocos2d-x loader: You can export scene created in editor as json file (structure for the same is available in /resources/loaders folder), which can then be loaded in game engine. Sample image (pika.bmp) is provided in the /resources folder. Image should be grayscale with shape blocked in white color and background (area to be clipped) in black. To use auto trace, select "Shape From Bitmap" from "Create Shape" dropdown. Concave shape is decomposed to array of convex shapes, as Box2d supports only convex shapes Auto TraceĬoncave Hull generation to create shapes from bitmap image easily. Mark Bayazit's Algorithm is used to decompose concave shapes. To create rope joint, select two bodies -> create rope joint.To create prismatic joint, select two bodies -> create prismatic joint.To create gear joint, select two bodies and either two revolute or two prismatic joints or one revolute and one prismatic joint -> create gear joint.


To create distance joint, select two bodies -> create distance joint.JOINT_ROPE // distance between two bodies can be constrained JOINT_PRISMATIC // a body's translation can be constrained along an axis (localAxis) Joint. JOINT_GEAR // a body can drive another body using either revolute/prismatic joint Joint. JOINT_PULLEY // bodies suspended from pulley Joint. JOINT_REVOLUTE // bodies can rotate about localAnchorB Joint. JOINT_WELD // bodies are glued to each other Joint. JOINT_DISTANCE // fixed distance between bodies Joint.
