I have one object in my screen, i want to duplita N times around the center of the screen.
So 2 times will create an opposite, 3 would create 3 objects with triangle shape, an so…
What i am doing is creating N duplicates, add a pivot joint adn try to rotate it 360/n
The problem is, i dont know why…the angles increase and decrease not regular.
Please a help: this is the actual code:
local function multiply(event)
–This is N times to duplicate
local rate=event.target.rate
–storyboard.editing is the original object
storyboard.editing.isVisible=false
–Angle diference
local angle=360/rate
for i=1,rate do
allTriggers[#allTriggers + 1]=movieclip.newAnim{“b_i.png”,“b_a.png”}
local o=allTriggers[#allTriggers]
o:setReferencePoint( display.CenterReferencePoint )
o.type=storyboard.editing.type
o.name=storyboard.editing.name
o:addEventListener( “touch”, startDrag )
o:addEventListener(“tap”, onTap)
o.subtype=storyboard.editing.subtype
o.isBullet=true
o.active=1
o.soundid=storyboard.editing.soundid
if not(storyboard.editing.soundid==nil) then
o:stopAtFrame( 2 )
end
o.image=storyboard.editing.image
o.x, o .y = storyboard.editing.x, storyboard.editing.y
o.rotation=storyboard.editing.rotation
physics.addBody( o, “dinamic”,{ density=1.0,radius=25,bounce=1.0,filter=pulseFilter } )
local tempjoint=physics.newJoint( “pivot”, o, center,center.x,center.y)
local anglevar=angle*i
o:rotate(anglevar)
anglevar=nil
tempjoint:removeSelf()
items:insert(o)
end
storyboard.editing:removeSelf()
end [import]uid: 113117 topic_id: 26113 reply_id: 326113[/import]