Circles touching Lines
Author |
Message |
allrace1337
|
Posted: Wed Sep 19, 2007 6:21 pm Post subject: Circles touching Lines |
|
|
I want to make it so if the circles touch the lines, it ends the program.
So far, I have this, but I plan to find a random maze generator. Can anyone can help me with that too.
Thanks
var x,y,w,z : int
x:=30
y:=35
w:=30
z:=45
var chars : array char of boolean
loop
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) then
y:=y+5
end if
if chars (KEY_RIGHT_ARROW) then
x:=x+5
end if
if chars (KEY_LEFT_ARROW) then
x:=x-5
end if
if chars (KEY_DOWN_ARROW) then
y:=y-5
end if
if chars ('s') then
z:=z+5
end if
if chars ('c') then
w:=w+5
end if
if chars ('z') then
w:=w-5
end if
if chars ('x') then
z:=z-5
end if
drawoval(w,z,4,4,1)
drawoval(x,y,4,4,4)
drawline (620,375,20,375,7)
drawline (20,375,20,25,7)
drawline (20,25,620,25,7)
drawline (620,25,620,375,7)
delay(100)
cls
end loop |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
mitchenerjosh

|
Posted: Wed Sep 19, 2007 7:10 pm Post subject: Re: Circles touching Lines |
|
|
I have been wondering this also, but is there anyways you can make the circle just stop at the line and not go past it instead of making the program end? |
|
|
|
|
 |
Saad

|
Posted: Fri Sep 21, 2007 5:53 am Post subject: RE:Circles touching Lines |
|
|
Search whatdotcolor and check if the color above/below/sides is not the same as the wall
eg
code: | if chars (KEY_UP_ARROW) and whatdotcolor (x, y + 5) ~= 7 then |
|
|
|
|
|
 |
allrace1337
|
Posted: Mon Sep 24, 2007 4:36 pm Post subject: RE:Circles touching Lines |
|
|
ok
Thanks a lot! |
|
|
|
|
 |
|
|