Android Question How to add colour or image to lgBox2DPolygonShape

noclass1980

Active Member
Licensed User
Longtime User
HI, if you have noticed my recent posts about using the libGDX library ( I'm flattered if you have!) then maybe you can help me? Using Infomatix's excellent examples, I have a programme that creates the bodies I need, rotates them as I want to etc etc. However, one thing escapes me. I create a number of Polygon shapes using

B4X:
For i=1 To 100
 Dim bd As lgBox2DBodyDef
 bd.Type = World.BODYTYPE_Dynamic
 bd.position.set(.50, 10)     
 Dim body As lgBox2DBody = World.CreateBody(bd)
 Dim pShape As lgBox2DPolygonShape
 pShape.SetAsBox(0.125, 0.125)
 body.createFixture2(pShape, 1)
 pShape.dispose     
 Next

So how do I attach a colour or an image to these polygon shapes? I don't want anything to clever, just a colour would do so that when I run the code without the debugrenderer I can see the coloured objects (and not the bodies). Any suggestions welcome. Thanks
 
Last edited:
Top