example from me:
//agk 2.0.16
//MR
// Click or Drag
type TDrag
spr
hit
hittime as float
clicked
drag
ox as float
oy as float
endtype
local item as TDrag
item.spr=CreateSprite(0)
SetSpritePositionByOffset(item.spr,50,50)
do
if GetPointerPressed()
if GetSpriteHitTest(item.spr,GetPointerX(),GetPointerY())
item.hit=1
item.hittime=timer()
item.ox=GetSpriteXByOffset(item.spr)-GetPointerX()
item.oy=GetSpriteYByOffset(item.spr)-GetPointerY()
else
item.hit=0
endif
elseif GetPointerState()=1 and item.hit=1
if timer()-item.hittime>0.5
item.drag=1
endif
elseif GetPointerReleased()
if timer()-item.hittime<=0.5 and item.hit=1
item.clicked=1
endif
item.hit=0
item.drag=0
endif
Info("Hit",item.hit)
Info("Clicked",item.clicked)
Info("Drag",item.drag)
if item.clicked=1
item.clicked=0
SetSpriteColor(item.spr,Random2(32,255),Random2(32,255),Random2(32,255),255)
endif
if item.drag=1
SetSpritePositionByOffset(item.spr,item.ox+GetPointerX(),item.oy+GetPointerY())
endif
sync()
loop
end
function Info(name$,value)
print(name$+" : "+str(value))
endfunction
AGK (Steam) V2.0.16 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)