Aikiman wrote: "Im trying to print the dsitance between 2 points"
global down_sprite
down_sprite=CreateSprite(0)
SetSpriteColor(down_sprite, 255, 0, 0, 255)
SetSpriteSize(down_sprite, 16, 16)
SetSpriteOffset(down_sprite, 8, 8)
SetSpriteVisible(down_sprite, 0)
Function Distance2D(x1, y1, x2, y2)
result as integer
part1 = Pow((x2 - x1), 2)
part2 = Pow((y2 - y1), 2)
underRadical = part1 + part2
result = Sqrt(underRadical)
EndFunction result
global down_x, down_y
do
if GetPointerPressed()
down_x=GetPointerX()
down_y=GetPointerY()
SetSpritePositionByOffset(down_sprite, down_x, down_y)
SetSpriteVisible(down_sprite, 1)
endif
if GetPointerReleased()
SetSpriteVisible(down_sprite, 0)
endif
if GetPointerState()
cur_x=GetPointerX()
cur_y=GetPointerY()
Print( Distance2D(down_x, down_y, cur_x, cur_y) )
DrawLine(down_x, down_y, cur_x, cur_y, 255, 255)
endif
Sync()
loop