
-----------------------------------
Prognosis
Sat Jan 21, 2006 11:10 pm

Lines, and time.
-----------------------------------
Well, im new to these forums, but i consider myself a fast learner, and am using turing for my first few months. Ive already made my program so it makes a line from the center of the screen to where you click, and it keeps going. I did this by finding out the equation of the line (using the center point, and where you clicked), and drew the line pixel by pixel. BUT..
There are many bugs, such as:
1. the speed of the line getting drawn changes in comparison to where you click.
2: in some places (when xclick and centerx are closer together), it isnt a line, but a series of dots. 
Those 2 errors sound weird now, but they will become more clear when the program is run. Please help me to fix these bugs. Also, help me to enable you to shoot more than one line out at once (this is because these lines are accually lazers for my new game)


var m, b, xl, yl : real
var x, y, button, x2, y2, rol : int
const xm := maxx div 2
const ym := maxy div 2

m := 0
b := 0
xl := xm
yl := ym
x := 0
y := 0
x2 := 0
y2 := 0
%right or left.. right=1, left=2,equal=middle
rol := 0
loop
loop
    mousewhere (x, y, button)
    if button = 1 then
        %putting current values for your mouse into new variables
        x2 := x
        y2 := y
        %finding out the slope(m) and y intercept(b) for your line.
        if x2=xm then
        exit
        else
        m := (y2 - ym) / (x2 - xm)
        end if
        b := - (m * x2) + y2
        %finding out the relation the dot to the middle of the screen
        if x2 > xm then
            rol := 1
        elsif x2 < xm then
            rol := 2
        elsif x2 = xm then
            rol := 3
        end if
        loop
            drawdot (round (xl), round (yl), 7)
            if rol = 1 then
                xl += 1
            elsif rol = 2 then
                xl -= 1
            elsif rol = 3 then
            end if
            yl := m * xl + b
            delay (2)
            if xl>maxx or xlmaxy or yl