Dim sh As Shape Dim OffsetX As Integer Dim OffsetY As Integer Dim Factor As Integer Sub esaminaForme() percorso = "F:\documenti\Progetti\liquid\gideros\gideros-master\plugins\liquidfun\source\liquidfun\Box2D\lfjs\testbed\tests\" Dim shs As Shapes Dim liqTLX As Integer Dim liqTLY As Integer Dim liqBRX As Integer Dim liqBRY As Integer Dim FormCount As Integer liqTLX = -6 liqTLY = 8 liqBRX = 6 liqBRY = 0 liqWidth = liqBRX - liqTLX ' 14 liqHeight = liqTLY - liqBRY ' 8 OffsetX = -400 OffsetY = 0 Factor = 2 LiquidFunScript = percorso & "testParticles.js" Open LiquidFunScript For Output As #1 Print #1, "function TestParticles() {" Print #1, " camera.position.y = 4;" Print #1, " camera.position.z = 8;" Print #1, " var bd = new b2BodyDef();" Print #1, " var ground = world.CreateBody(bd);" Print #1, "" Print #1, "" Print #1, "// ACQUA" Print #1, "shape2 = new b2PolygonShape();" Print #1, "vertices = shape2.vertices;" Print #1, "var psd = new b2ParticleSystemDef();" Print #1, "psd.radius = 0.040;" Print #1, "var particleSystem = world.CreateParticleSystem(psd);" Print #1, "//------------" For FormCount = 1 To Application.ActiveSheet.Shapes.Count Set sh = Application.ActiveSheet.Shapes(FormCount) Print #1, "// Forma n." & Str(FormCount) Print #1, "shape2 = new b2PolygonShape();" Print #1, "vertices = shape2.vertices;" Call Crea Print #1, "// ===========" Print #1, "" Next 'Set sh = Application.ActiveSheet.Shapes(FormCount) 'Call Crea Print #1, "/*" Print #1, "// Pezzo che cade" Print #1, "bd = new b2BodyDef()" Print #1, "var circle = new b2CircleShape();" Print #1, "bd.type = b2_dynamicBody;" Print #1, "var body = world.CreateBody(bd);" Print #1, "circle.position.Set(0, 8);" Print #1, "circle.radius = 0.5;" Print #1, "body.CreateFixtureFromShape(circle, 0.5);" Print #1, "*/" Print #1, "}" Close #1 Debug.Print "Ok." End Sub Sub Crea() Set debugSH = sh If sh.AutoShapeType = msoShapeRectangle Then Xorg = sh.Left Yorg = sh.Top Xconv = Factor * (Xorg + OffsetX) / 100 Yconv = Factor * (400 - Yorg + OffsetY) / 100 Print #1, "vertices.push(new b2Vec2(" & Replace(Xconv, ",", ".") & " ," & Replace(Yconv, ",", ".") & "));" Xorg = sh.Left + sh.Width Yorg = sh.Top Xconv = Factor * (Xorg + OffsetX) / 100 Yconv = Factor * (400 - Yorg + OffsetY) / 100 Print #1, "vertices.push(new b2Vec2(" & Replace(Xconv, ",", ".") & " ," & Replace(Yconv, ",", ".") & "));" Xorg = sh.Left + sh.Width Yorg = sh.Top + sh.Height Xconv = Factor * (Xorg + OffsetX) / 100 Yconv = Factor * (400 - Yorg + OffsetY) / 100 Print #1, "vertices.push(new b2Vec2(" & Replace(Xconv, ",", ".") & " ," & Replace(Yconv, ",", ".") & "));" Xorg = sh.Left Yorg = sh.Top + sh.Height Xconv = Factor * (Xorg + OffsetX) / 100 Yconv = Factor * (400 - Yorg + OffsetY) / 100 Print #1, "vertices.push(new b2Vec2(" & Replace(Xconv, ",", ".") & " ," & Replace(Yconv, ",", ".") & "));" Else For i = 1 To sh.Nodes.Count Xorg = sh.Nodes(i).Points(1, 1) Yorg = sh.Nodes(i).Points(1, 2) Xconv = Factor * (Xorg + OffsetX) / 100 Yconv = Factor * (400 - Yorg + OffsetY) / 100 Print #1, "vertices.push(new b2Vec2(" & Replace(Xconv, ",", ".") & " ," & Replace(Yconv, ",", ".") & "));" Next End If If sh.Fill.ForeColor.RGB = 5296274 Then Print #1, "var pgd = new b2ParticleGroupDef();" Print #1, "pgd.shape = shape2;" Print #1, "pgd.color.Set(255, 0, 0, 255);" Print #1, "particleSystem.CreateParticleGroup(pgd);" Else Print #1, "ground.CreateFixtureFromShape(shape2, 0);" End If End Sub