How To Make Any Object On Screen Drag-Able

i am looking for a feature that will make a certain object i put on screen touchable!

any information will be greatly appreciated!!!

to be specific, i want code to make the objects, what is the correct term to use, sendable so little force will send the object off screen
 

I think you have to set the physics first at the begining of your program for that you have to write something like this

local physics = require “physics”
physics.start()
physics.setGravity(0,0) 

and then suppose a stick is hitting a ball here then, (adjust x and y location according to your screen)

–FOR THE STICK

local stick = display.newImage(“images/stick.png”)
plane.x = 1100
plane.y = 200
physics.addBody(stick, “static”)

and

–FOR THE BALL

local ball = display.newImage(“images/ball.png”)
plane.x = 1100
plane.y = 200
physics.addBody(ball, “dynamic”)

– you can see one of the item is static and another one is dynamic. Otherwise thy would not act like a normal object and would not push each other.

I think you have to set the physics first at the begining of your program for that you have to write something like this

local physics = require “physics”
physics.start()
physics.setGravity(0,0) 

and then suppose a stick is hitting a ball here then, (adjust x and y location according to your screen)

–FOR THE STICK

local stick = display.newImage(“images/stick.png”)
plane.x = 1100
plane.y = 200
physics.addBody(stick, “static”)

and

–FOR THE BALL

local ball = display.newImage(“images/ball.png”)
plane.x = 1100
plane.y = 200
physics.addBody(ball, “dynamic”)

– you can see one of the item is static and another one is dynamic. Otherwise thy would not act like a normal object and would not push each other.