Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
circuit trace drawer
#1
i been working on a program to draw random circuit traces.. its a major WIP but its coming along nicely... wanna see?

Code:
'to do
'1. add about 2 or 3 more lines
'2. make it so when the lines intersect each other, a small circle is drawn
'   gonna be tough, need to figure out some sortof collision detection

option explicit
randomize timer

screen 18

dim shared x as integer                'xpos of line
dim shared y as integer                'ypos of line
dim shared kolor as integer            'color of line
dim shared line_length as integer      'length of line
dim shared a as integer
dim shared i as integer

declare sub down()              'draw line moving in downward motion
declare sub up()                'draw line moving in upward motion
declare sub rightward()         'draw line moving in right motion
declare sub leftward()          'draw line moving in left motion
declare sub up_and_right()      'draw line moving up and to the right
declare sub up_and_left()       'draw line moving up and to the left
declare sub down_and_right()    'draw line moving down and to the right
declare sub down_and_left()     'draw line moving down and to the left

declare sub loop_selector()

x = 100
y = 100
line_length = 100
kolor = 3
a = 0

loop_selector

sub loop_selector()
    i = 0
    do
        a = rnd * 8
        if a = 0 then call down_and_left() end if
        if a = 1 then call down_and_right() end if
        if a = 2 then call up_and_left() end if
        if a = 3 then call up_and_right() end if
        if a = 4 then call down() end if
        if a = 5 then call up() end if
        if a = 6 then call leftward() end if
        if a = 7 then call rightward() end if
    loop
end sub



'---------------------drawing subs-----------------------------
'diag down and left
sub down_and_left()

while i < line_length - 85
    pset (x,y),kolor
    pset (x + 2,y + 2),kolor
    pset (x + 4,y + 4),kolor
    i = i + 1
    y = y + 1
    x = x - 1
    sleep 50
    if i = line_length then call loop_selector end if
wend

end sub


'diag down and right
sub down_and_right

while i < line_length - 85
    pset (x,y),kolor
    pset (x + 2,y + 2),kolor
    pset (x + 4,y + 4),kolor
    i = i + 1
    y = y + 1
    x = x + 1
    sleep 50
    if i = line_length then call loop_selector end if
wend

end sub

'diag up and left
sub up_and_left()

while i < line_length - 85
    pset (x,y),kolor
    pset (x + 2,y + 2),kolor
    pset (x + 4,y + 4),kolor
    i = i + 1
    y = y - 1
    x = x - 1
    sleep 50
    if i = line_length then call loop_selector end if
wend

end sub

'diag up and right
sub up_and_right()

while i < line_length - 85
    pset (x,y),kolor
    pset (x + 2,y + 2),kolor
    pset (x + 4,y + 4),kolor
    i = i + 1
    y = y - 1
    x = x + 1
    sleep 50
    if i = line_length then call loop_selector end if
wend

end sub


'leftward movement
sub leftward()

while i < line_length
    pset (x,y),kolor
    pset (x + 2,y + 2),kolor
    pset (x + 4,y + 4),kolor
    i = i + 1
    x = x - 1
    sleep 50
    if i = line_length then call loop_selector end if
wend

end sub

'rightward movement
sub rightward()

while i < line_length
    pset (x,y),kolor
    pset (x + 2,y + 2),kolor
    pset (x + 4,y + 4),kolor
    i = i + 1
    x = x + 1
    sleep 50
    if i = line_length then call loop_selector end if
wend

end sub

'upward movement
sub up()

while i < line_length
    pset (x,y),kolor
    pset (x + 2,y + 2),kolor
    pset (x + 4,y + 4),kolor
    i = i + 1
    y = y - 1
    sleep 50
    if i = line_length then call loop_selector end if
wend

end sub


'downward movement
sub down()

while i < line_length
    pset (x,y),kolor
    pset (x + 2,y + 2),kolor
    pset (x + 4,y + 4),kolor
    i = i + 1
    y = y + 1
    sleep 50
    if i = line_length then call loop_selector end if
wend

end sub

i'm sure there are better ways to do it.. but i just want it to work..lol Big Grin
url=http://www.random-seed.net][Image: asylumsig.png][/url]
Reply
#2
Hehe nice Smile

What exactly is it?
Reply
#3
its a program that draws randome circuit traces.. its ment as a visualization, its a WIP so it doesetn look to good yet... but hopefully it will when i'm finihsed.. i'm going to use the effect in a demo i'm working on if i ever get all the planned effects done
url=http://www.random-seed.net][Image: asylumsig.png][/url]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)