i’ve tried a litte bit.
the problem was the referencePoint. in the API (http://developer.anscamobile.com/reference/index/objectsetreferencepoint) was the info, that you must update the refPoint after changes to the groupmembers.
so in this example, i put the setReferencePoint after the two inserts.
ah, and i don’t insert the button. was a little bit funny, to tap on an rotating button…
[lua]local physics = require( “physics” )
physics.start()
physics.setGravity( 0, 0 )
localGroup2 = display.newGroup()
local outerFrame = display.newImage(“images/crate.png”)
outerFrame.x = 50; outerFrame.y = 100
localGroup2:insert(outerFrame)
local block = display.newImage(“images/enemy.png”)
block.x = 100; block.y = 200
physics.addBody( block, “static”, 0)
localGroup2:insert(block)
local button = display.newImage( “images/button.png” )
button.x = display.contentWidth / 2
button.y = display.contentHeight - 50
–localGroup2:insert(button)
localGroup2:setReferencePoint(display.CenterReferencePoint);
local rotateIt = function( event )
print( "R! center: ", display.CenterReferencePoint, block.CenterReferencePoint )
if 1 == event.numTaps then
localGroup2:rotate( 5 )
end
end
button:addEventListener( “tap”, rotateIt )[/lua] [import]uid: 42078 topic_id: 8040 reply_id: 29232[/import]