Urgent Help
Author 
Message 
CyCLoBoT

Posted: Thu Feb 20, 2003 7:10 am Post subject: Urgent Help 


How do I draw a line from the center of the spaces between the lines surrounding the 10x10 grid so that when the user clicks on any of the space in between the lines, it draws a line from the center of the space going in the direction of the lines its has been shot. If the person clicks between the lines on the Left Side, the line should go to to right.
code:  var wino := Window.Open ("graphics:480;480,noecho, nocursor")
var x, y, x1, y1 : int
var cordinatex : array 1 .. 5 of int
var cordinatey : array 1 .. 5 of int
for i : 1 .. 11
drawline (60 + i * 30, 90, 60 + i * 30, 390, 17)
drawline (90, 60 + i * 30, 390, 60 + i * 30, 17)
drawline (60 + 30 * i, 30, 60 + 30 * i, 60, black)
drawline (60 + 30 * i, 420, 60 + 30 * i, 450, black)
drawline (30, 60 + 30 * i, 60, 60 + 30 * i, black)
drawline (420, 60 + 30 * i, 450, 60 + 30 * i, black)
end for
for i : 1 .. 5
x := 90 + (Rand.Int (2, 9) * 30)  15
y := 90 + (Rand.Int (2, 9) * 30)  15
cordinatex (i) := x
cordinatey (i) := y
drawfilloval (x, y, 13, 13, 7)
end for
var button : int
loop
Mouse.Where (x1, y1, button)
%The bottom Lines
if x1 > 91 and x1 < 389 and y1 > 30 and y1 < 60 and button = 1 then
%The Top Lines
elsif x1 > 91 and x1 < 389 and y1 > 420 and y1 < 450 and button = 1 then
%Left Lines
elsif x1 > 30 and x1 < 60 and y1 > 91 and y1 < 389 and button = 1 then
%Right Lines
elsif x1 > 420 and x1 < 450 and y1 > 91 and y1 < 389 and button = 1 then
end if
end loop 






Sponsor Sponsor



Izzy

Posted: Thu Feb 20, 2003 8:02 am Post subject: (No subject) 


Heya.
Sorry, I'm not totally with you on what you want, I got the part about creating a centered line in the area you click in, but the direction and it shooting to the right threw me off. Clarify and i'll help.
 Izzy






CyCLoBoT

Posted: Thu Feb 20, 2003 8:12 am Post subject: (No subject) 


Sorry I didn't specify too well. All those lines on the side of the 10x10 grid have spaces in between. The user clicks in those spaces and the line should go towards the grid. If the user clicks on the spaces on top of the grid, the line should go down toward the grid. If the user clicks between the lines on the left side of the grid, the line should go towards the right and so on. The line always passes through the columns or rows of the grid.
I have explained it through a picture:
http://funware.topcities.com/picture.htm






Izzy

Posted: Thu Feb 20, 2003 8:25 am Post subject: (No subject) 


Here Ya'go! I hope this is what you were after =P
code:  var wino := Window.Open ("graphics:480;480,noecho, nocursor")
var x, y, x1, y1 : int
var cordinatex : array 1 .. 5 of int
var cordinatey : array 1 .. 5 of int
for i : 1 .. 11
drawline (60 + i * 30, 90, 60 + i * 30, 390, 17)
drawline (90, 60 + i * 30, 390, 60 + i * 30, 17)
drawline (60 + 30 * i, 30, 60 + 30 * i, 60, black)
drawline (60 + 30 * i, 420, 60 + 30 * i, 450, black)
drawline (30, 60 + 30 * i, 60, 60 + 30 * i, black)
drawline (420, 60 + 30 * i, 450, 60 + 30 * i, black)
end for
for i : 1 .. 5
x := 90 + (Rand.Int (2, 9) * 30)  15
y := 90 + (Rand.Int (2, 9) * 30)  15
cordinatex (i) := x
cordinatey (i) := y
drawfilloval (x, y, 13, 13, 7)
end for
var button : int
loop
Mouse.Where (x1, y1, button)
if x1 > 90 and x1 < 390 and y1 > 30 and y1 < 60 and button = 1 then %The bottom Lines
x1 := floor((x1  90) / 30)
x1 := 105 + (x1 * 30)
drawline(x1,30,x1,450,black)
elsif x1 > 90 and x1 < 390 and y1 > 420 and y1 < 450 and button = 1 then %The Top Lines
x1 := floor((x1  90) / 30)
x1 := 105 + (x1 * 30)
drawline(x1,30,x1,450,black)
elsif x1 > 30 and x1 < 60 and y1 > 90 and y1 < 390 and button = 1 then %Left Lines
y1 := floor((y1  90) / 30)
y1 := 105 + (y1 * 30)
drawline(30,y1,450,y1,black)
elsif x1 > 420 and x1 < 450 and y1 > 90 and y1 < 390 and button = 1 then %Right Lines
y1 := floor((y1  90) / 30)
y1 := 105 + (y1 * 30)
drawline(30,y1,450,y1,black)
end if
end loop 
 Izzy






CyCLoBoT

Posted: Thu Feb 20, 2003 9:27 am Post subject: (No subject) 


hey Izzy there are two more things with this thing if u can help me out. U know how the lines go through those black circles. I wanted to make it so that if the line hits the circle, the circle turns a different color. And if the line goes through any of the diagonals that surround the circles, the line is reflected 90 degrees. I would really appreciate it if u can help me out.
Here is the picture to explain it better:
http://funware.topcities.com/pic.htm






Izzy

Posted: Thu Feb 20, 2003 12:33 pm Post subject: (No subject) 


Hey,
Sorry about the wait, I had a little "family" night! =P
Anyway, no problem! I'll fix it all up for you tomorrow, I've gotta finish my h/w so I don't have time tonight. Sorry.
 Izzy






CyCLoBoT

Posted: Tue Feb 25, 2003 11:48 am Post subject: (No subject) 


Hey can anyone else help me out with this program? Izzy was suppose to help me but he has not been online for a while and I need help urgently. I have posted in previous post with what I need help with. Anyone who can help me would be great.







