hi, i tried searching about bout i must have been searching using the wrong words, but i can't seem to figure out the right code for this. any ideas?
making point go from to x,y to x1,xy
BlitzPlus Forums/BlitzPlus Programming/making point go from to x,y to x1,xy it's ok, i got it. was using sin instead of tan :S
Here's something I knocked together a long time ago...
Graphics 640,480,16 SetBuffer BackBuffer() ; randomise starts and ends SeedRnd(MilliSecs()) .start startx#=Rand(0,639) starty#=Rand(0,479) endx#=Rand(0,639) endy#=Rand(0,479) number_of_steps#=Rand(10,200) dir=1 Repeat ; move point If dir=1 Then n=n+1: If n>=number_of_steps Then n=number_of_steps:dir=0 If dir=0 Then n=n-1: If n<=0 Then n=0:dir=1 ; calculate location xpos#=startx+(((endx-startx)/number_of_steps)*n) ypos#=starty+(((endy-starty)/number_of_steps)*n) ; draw screen Cls Color 100,100,100 Line startx,starty,endx,endy Color 200,20,20 : Rect startX-3,startY-3,7,7 Color 20,200,20 : Rect endX-2,endY-2,5,5 Color 200,200,20: Oval xpos-4,ypos-4,9,9,True Text 5,5,"Distance="+Sqr(((startx-endx)*(startx-endx))+((starty-endy)*(starty-endy))) Text 5,20,"Speed="+Sqr(((startx-endx)*(startx-endx))+((starty-endy)*(starty-endy)))/number_of_steps Text 5,40,"Position="+Int((n/number_of_steps)*100)+"%" Flip If KeyHit(1) Then End Until KeyHit(57) Goto start End
cool, thanks alot Rob. i'll use that instead of the stuff i've got.
cheers :D
cheers :D