spawning jointed objects

hii,i am studying the concept of spawning.now i can spawn simple object like simple shapes(circle,squre,image),but i wanted to spawn physics objects joined by physics joints .so i write a program

but didnt work …my problem is i dont know the real concept of spawning jointed objects.

here is part my code …

local physics=require("physics") physics.start() local t={} local ball1=display.newCircle(0,0,20) physics.addBody(ball1,"dynamic") ball1.gravityScale=o ball1:setFillColor(0.20,0.20,0.20); ball1.x=200+display.screenOriginX ball1.y=300+display.screenOriginY table.insert(t,ball1) ball2=display.newCircle(0,0,20) physics.addBody(ball2,"dynamic") ball2.gravityScale=o ball2:setFillColor(0.0,0.20,0.20); ball2.x=220+display.screenOriginX ball2.y=300+display.screenOriginY ball2.isSensor=true table.insert(t,ball2) local pivotJoint = physics.newJoint( "pivot", ball1,ball2, ball1.x, ball1.y ) table.insert(t,pivotJoint) print(#t) local b={} b[#b+1]={t} print(#b) local enemy=b[1] enemy:setLinearVelocity(-15,0)

Have you looked at the physics joints example that comes with Corona?

Run Corona Simulator:

  • Click Samples link on simulator app
  • Scroll to physics in pop-up
  • Run ‘Joints’ example.

You can then open the source folder from one of the simulator menus at the top (different for Mac and Windows) and examine the code.

@roaminggamer

thanks …but physics joints is not my problem…actually i have made some enemies for my game which consist two bodies (using physics joints).but i dont know how to spawn such objects or enemies…i want some of these objectsto travel across the screen from right to left 

time to time…

i have made a program for spawning process …but i dont know how to track individual bodies of these objects…

Have you looked at the physics joints example that comes with Corona?

Run Corona Simulator:

  • Click Samples link on simulator app
  • Scroll to physics in pop-up
  • Run ‘Joints’ example.

You can then open the source folder from one of the simulator menus at the top (different for Mac and Windows) and examine the code.

@roaminggamer

thanks …but physics joints is not my problem…actually i have made some enemies for my game which consist two bodies (using physics joints).but i dont know how to spawn such objects or enemies…i want some of these objectsto travel across the screen from right to left 

time to time…

i have made a program for spawning process …but i dont know how to track individual bodies of these objects…