Games [XUI2D] Drawing lines example

Erel

Administrator
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:
B4X:
X2.GraphicCache.PutGraphic2(gname, Array(sb), antialias, 3)
The example is included in the examples pack: https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/

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