Ok, sorted it. The flower is slightly transparent and gives the effect of lighting up when the finger tip touches it. It’s not perfect, but I’m sure you can tweak the image and the physics body outline, maybe by using PhysicsEditor…
Full solution: https://dl.dropboxusercontent.com/u/10254959/Help/DragFingerTouchHelp/DragFingerTouchHelp.zip
Code:
-- drag finger touch demo require("physics") physics.start() physics.setDrawMode("normal") -- use "hybrid" to see the physics bodies physics.setGravity(0,0) local stage = display.getCurrentStage() local flower = display.newImage( "flower.png" ) flower.x, flower.y = display.contentCenterX, display.contentCenterY flower.alpha = .7 physics.addBody( flower, { outline=graphics.newOutline( 20, "flower.png" ), isSensor=true } ) local finger = display.newImage( "finger.png" ) finger.x, finger.y = display.contentWidth-finger.width, display.contentHeight-finger.height local function newSensor( x, y ) local group = display.newGroup() group.x, group.y = x, y physics.addBody( group, "dynamic", { isSensor=true, radius=10 } ) function group:collision(e) if (e.phase == "began") then flower.alpha = 1 else flower.alpha = .7 end return true end group:addEventListener("collision",group) return group end local function touch(e) if (e.phase == "began") then e.target.hasFocus = true stage:setFocus( e.target ) e.target.prev = e e.target.sensor = newSensor( e.target.x-84, e.target.y-92 ) return true elseif (e.target.hasFocus) then local dx, dy = e.x-e.target.prev.x, e.y-e.target.prev.y e.target.x, e.target.y = e.target.x+dx, e.target.y+dy e.target.sensor.x, e.target.sensor.y = e.target.sensor.x+dx, e.target.sensor.y+dy if (e.phase == "moved") then else stage:setFocus( nil ) e.target.hasFocus = false e.target.sensor:removeSelf() e.target.sensor = nil end e.target.prev = e return true end return false end finger:addEventListener( "touch", touch )