Line tracing

Jim Hurley jhurley at infostations.com
Sat Feb 1 08:07:01 CST 2003


>Roger Guay Wrote:
>
>

(snip)

>on MouseUp
>    global V, Xo, Yo, Theta, T, X
>    --put item 1 of the rect of graphic "Yaxis" into  Xo.  Yaxis is a
>vertical line and Xo,Yo define the origin of motion
>    --put item 4 of the rect of graphic "Yaxis" into  Yo.
>    put field "V" into V    ---- try a value of about 27 in field "V"
>    Put the value of field "Theta" into Theta  ----try a value of 1.2 
>in field "Theta"
>    set the loc of graphic "mortor" to Xo,Yo   ---- Graphic "mortor" is a
>small red round ball.
>    show graphic "mortor"
>    put 0 into T
>    put xo into x
>    put Yo into y
>    play "Mortor.aiff"
>    repeat while Y <= Yo + 1
>      add 1 to T
>      put the value of (Xo+V*cos(Theta)*T     ) into x
>      put the value of (Yo - V*sin(Theta)*T + .5*T^2  ) into Y
>      set the loc of graphic "mortor" to X,Y
>      wait 1
>    end repeat


Roger,

P.S.

You may want to consider using: sin(Theta*180/pi) so that you can use 
degrees instead of radians in you angle field. Or perhaps write a 
separate function:

function sine ang
   return sin(ang*180/pi)
end sine

And do the same for cosine.

Jim



More information about the use-livecode mailing list