i found a example from forum post.
SetVirtualResolution ( 640, 960 )
//SetVirtualResolution ( 960, 640 )
SetOrientationAllowed( 1, 0, 0, 0 )
SetPhysicsScale( 0.01 )
SetPhysicsGravity( 0, 0 )
setphysicsdebugon()
createsprite(3,0)
setspritesize(3,getvirtualwidth(),getvirtualheight())
setspritecolor(3,64,64,128,255)
setspritetransparency(3,0)
// create a sprite and position it in the center of the screen
CreateSprite ( 1,0 )
setspritesize(1,60,-1)
SetSpriteShape ( 1, 1 )
SetSpritePosition ( 1, getvirtualwidth()/2.0, getvirtualheight()/2.0 )
SetSpritePhysicsOn (1,2)
SetSpritePhysicsRestitution ( 1, 0.95 )
SetSpritePhysicsFriction ( 1, 0.5 )
//setspritephysicscanrotate( 1, 1)
//Maus
CreateSprite (2, 0)
setspritesize(2,30,-1)
SetSpriteShape ( 2, 1 )
SetSpritePositionByOffset (2,getvirtualwidth()/4.0, getvirtualheight()/2.0)
SetSpritePhysicsOn (2,2)
SetSpritePhysicsFriction ( 2, 0.5 )
SetSpritePhysicsRestitution( 2, 0.5 )
//setspritephysicscanrotate( 2, 1)
CreateMouseJoint ( 1, 2, getspritexbyoffset(2), getspriteybyoffset(2), 1000000000 )
Type TDot
x#
y#
endtype
dim dots[101] as TDot
index=0
do
index=Memory(1,index)
Show()
if GetRawKeyState(27) = 1 then exit
mx# = GetPointerX()
my# = GetPointerY()
SetJointMouseTarget ( 1, mx#, my# )
sync()
loop
function Memory(spr,i)
dots[i].x#=getspritexbyoffset(spr)
dots[i].y#=getspriteybyoffset(spr)
i=i+1
if i>100 then i=0
endfunction i
function Show()
for i=0 to 100
x#=dots[i].x#
y#=dots[i].y#
drawline(x#,y#,x#,y#,255,255,0)
next
endfunction
AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670