ok, here, the tile images are different in size so i solved it so.
MainLoop()
end
Function MainLoop()
spr=createsprite(0)
setspritepositionbyoffset(spr,50,50)
img1=Loadimage("idle_right.png") //78 x 372
img2=loadimage("walk_right.png") //67 x 414
mode=1
do
print("press left or right mouse button")
//drawline(0,50-10,100,50-10, 128,128,128)
drawline(0,50,100,50, 255,255,0)
if GetRawMouseLeftPressed()
mode=1
endif
if GetRawMouseRightPressed()
mode=2
endif
if mode=1
SetSpriteImage ( spr, img1, 1 )
SetSpriteAnimation( spr, 78, 372/6, 6 )
setspritesize(spr,-1,10)
SetSpriteOffset(spr,getspritewidth(spr)/2.0,getspriteheight(spr))
PlaySprite( spr )
mode=0
elseif mode=2
SetSpriteImage ( spr, img2, 1 )
SetSpriteAnimation( spr, 67, 414/6, 6 )
setspritesize(spr,-1,11)
SetSpriteOffset(spr,getspritewidth(spr)/2.0,getspriteheight(spr))
PlaySprite( spr )
mode=0
endif
sync()
loop
endfunction
AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670