I can’t seem to piece everything together. I have a scalable display group with a draggable object within. I can drag the object correctly, but cannot bind it between boundaries. Thus far, any boundaries I make are not consistent between scales.
[lua]local drag = display.newImage(“bird.png”)
localGroup:insert(drag)
drag.x = 50; drag.y = 50
local function draggit( event )
local x, y = localGroup:localToContent( event.x, event.y )
if event.phase == “moved” then
–This is would boundaries would be set
drag.x = x; drag.y = y
end
return true
end[/lua]
Using exact numbers wont work like [lua] if x > 100 then drag.x = 50; end[/lua] nor does [lua]local x0,y0 = localGroup:localToContent( 100, 100 )[/lua]
Then I need the distance between this draggable object and another object. How would I do that? [import]uid: 54716 topic_id: 10763 reply_id: 310763[/import]