(AGK version: 108.13)
Submitted: 2013-06-17 13:24:32
Test()
end

function Test()

    do
        print("Click to Exit")

        if getpointerpressed()=1
            exit
        endif

        sync()
    loop

endfunction
(AGK version: 2.0.16)
Submitted: 2015-12-19 18:11:16
//agk 2.0.16
//MR
//simple swipe

SetWindowSize(1280,720,0)
SetVirtualResolution(160,90)

type TDrag
	spr as integer
	xstart as float
	ystart as float
	xend as float
	yend as float
	xtarget as float
	ytarget as float
	l as float
	mu as float
	move as integer
EndType

local drag as TDrag
local x as float
local y as float
local dx as float
local dy as float

local col as integer
col = MakeColor(255,255,0)

spr=CreateSprite(0)
SetSpritePosition(spr,50,50)
do
	print("click over the sprite and move mouse")
	
	if getPointerPressed()=1 
		hit = getSpriteHitTest(spr, getPointerX(), getPointerY())
		if hit=0
			 
		elseif hit=1
			drag.spr = spr
			if drag.spr>0
				drag.move=0
				drag.xstart = GetSpriteXByOffset(drag.spr)
				drag.ystart = GetSpriteYByOffset(drag.spr)
				drag.mu=0
				drag.l=0
			endif
		endif
	else
		if drag.spr>0 and drag.move=0
			if getPointerState()>0
				drag.xend = GetPointerX()
				drag.yend = GetPointerY()
				dx=( drag.xend - drag.xstart ) 
				dy=( drag.yend - drag.ystart )
				drag.xtarget = drag.xstart + dx * 2.0
				drag.ytarget = drag.ystart + dy * 2.0
				
				drag.l=sqrt(dx*dx + dy*dy)					
				 
			endif
		endif
	endif

	if drag.spr>0 and drag.l>5.0
		drag.move=1
		if drag.mu<1.0  
			drag.mu = drag.mu + (1.0 / 60.0)
			if drag.mu=>1.0
				drag.spr=0
				drag.move=0
			endif
		endif
		x=LinearInterpolate(drag.xstart,drag.xtarget,drag.mu)
		y=LinearInterpolate(drag.ystart,drag.ytarget,drag.mu)
		SetSpritePositionByOffset(drag.spr,x,y)	
	endif
	
	sync()
loop
end

function LinearInterpolate( y1 as float, y2 as float, mu as float)

	local f as float
	f=(y1*(1.0-mu)+y2*mu)

endfunction f
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.