Thanks Phaelax it's grate idea.
I improved it but seem during drawing line, more than one line is drawn. what do you think?
global line
DO
timer# = Timer()
if getPointerPressed() = 1
ResetTimer()
x1 = getRawMouseX()
y1 = getRawMouseY()
//create sprite
CreateSpr()
else
if getPointerState() = 1
x2 = getRawMouseX()
y2 = getRawMouseY()
drawSpriteLine(line, x1, y1, x2, y2, 1)
if timer# > 0.1 then DeleteSprite(line)
else
DeleteSprite(line)
endif
endif
sync()
LOOP
Function drawSpriteLine(s, x1, y1, x2, y2, thickness)
if GetSpriteExists(s) = 1
length = sqrt((x1-x2)^2 + (y1-y2)^2)
setSpriteSize(s, length, thickness)
setSpriteOffset(s, 0, thickness/2)
setSpritePositionByOffset(s, x1, y1)
a# = atanfull(x2-x1, y2-y1)-90
setSpriteAngle(s, a#)
endif
Endfunction
Function CreateSpr()
if GetSpriteExists(line) = 0
line = createSprite(0)
SetSpritePosition(line,-50,-50)
setSpriteColor(line, 255,255,255,255)
endif
EndFunction