Games [XUI2D] Drawing lines example


Staff member
Licensed User
This is really a nice example. You draw objects with your finger and they almost come to life:

Run with debug drawing to see the bodies structure:

Note that chain shapes cannot collide with other chain shapes in box2d. Instead we create bodies with multiple polygon shapes.

You can play with the angle interval to make it more accurate:
X2.GraphicCache.PutGraphic2(gname, Array(sb), antialias, 3)
The example is included in the examples pack:

Building the body shapes is not trivial. The code is quite short but is a bit complex. Post here if you need any explanation.