Move button

How to make a move button like this game

https://www.youtube.com/watch?v=BZGeoO1tu7M

this is my code

local myObject2 = display.newCircle( 200, 200,70 ) myObject2:setFillColor(128,128,128) local myObject = display.newCircle( 200, 200, 40 ) myObject:setFillColor(111,111,111) function myObject:touch( event ) if event.phase == "began" then self.markX = self.x self.markY = self.y elseif event.phase == "moved" then local x = (event.x - event.xStart) + self.markX local y = (event.y - event.yStart) + self.markY self.x, self.y = x, y if self.x \< 180 then self.x =180 elseif self.y \< 180 then self.y = 180 elseif self.x \> 220 then self.x = 220 elseif self.y \> 220 then self.y = 220 else self.x, self.y = x, y end elseif event.phase == "ended" then self.x , self.y = 200,200 end return true end myObject:addEventListener( "touch", myObject )

That is something called a virtual joystick.  There are several implementations in the Corona Community Code and I know the folks who built Particle Candy contributed one.  

See:  http://developer.coronalabs.com/code/

Thanks.

That is something called a virtual joystick.  There are several implementations in the Corona Community Code and I know the folks who built Particle Candy contributed one.  

See:  http://developer.coronalabs.com/code/

Thanks.