i don't have internet anymore, might be awhile before i get it back. i will check this forum when i can. i am having alot of trouble using arrays. i have rewrote my program it will now set it self to use max display mode. also having problems with the computer player on a pong game i have wrote, could use a sample program with AI so i can see how one would be wrote.
gosub screen_setup
randomize timer()
gosub setup
sync on
do
gosub dots
gosub l1_move
gosub l2_move
gosub l3_move
gosub keys
sync
loop
` ***** subs only here *****
screen_setup:
perform checklist for display modes
for n = 1 to checklist quantity()
width=checklist value a(n)
height=checklist value b(n)
depth=checklist value c(n)
next n
set display mode width,height,16
return
dots:
for n = 1 to 250
red
dot rnd(width -1),rnd(height -1)
white
dot rnd(width -1),rnd(height -1)
blue
dot rnd(width -1),rnd(height -1)
for n1 = 1 to 2
black
dot rnd(width -1),rnd(height -1)
next n1
next n
return
` *** line one red move ***
l1_move:
l1xs=l1xs + l1xspeed
l1ys=l1ys + l1yspeed
l1xe=l1xe - l1x_speed
l1ye=l1ye - l1y_speed
red
` line one x start
line l1xs,l1ys,l1xe,l1ye
white
circle l1xs,l1ys,5
blue
circle l1xe,l1ye,5
if l1xs =< 0
l1xs = 0
l1xspeed = l1xspeed * -1
else
if l1xs => width -1
l1xs = width -1
l1xspeed = l1xspeed * -1
endif
endif
` line one y start
if l1ys =< 0
l1ys = 0
l1yspeed = l1yspeed * -1
else
if l1ys => height -1
l1ys = height -1
l1yspeed = l1yspeed * -1
endif
endif
` line one x end
if l1xe =< 0
l1xe = 0
l1x_speed = l1x_speed * -1
else
if l1xe => width -1
l1xe = width -1
l1x_speed = l1x_speed * -1
endif
endif
` line one y end
if l1ye =< 0
l1ye = 0
l1y_speed = l1y_speed * -1
else
if l1ye => height -1
l1ye = height -1
l1y_speed = l1y_speed * -1
endif
endif
return
` *** line 2 white move ***
l2_move:
l2xs=l2xs + l2xspeed
l2ys=l2ys + l2yspeed
l2xe=l2xe - l2x_speed
l2ye=l2ye - l2y_speed
white
` line two x start
line l2xs,l2ys,l2xe,l2ye
red
circle l2xs,l2ys,5
blue
circle l2xe,l2ye,5
if l2xs =< 0
l2xs = 0
l2xspeed = l2xspeed * -1
else
if l2xs => width -1
l2xs = width -1
l2xspeed = l2xspeed * -1
endif
endif
` line two y start
if l2ys =< 0
l2ys = 0
l2yspeed = l2yspeed * -1
else
if l2ys => height -1
l2ys = height -1
l2yspeed = l2yspeed * -1
endif
endif
` line two x end
if l2xe =< 0
l2xe = 0
l2x_speed = l2x_speed * -1
else
if l2xe => width -1
l2xe = width -1
l2x_speed = l2x_speed * -1
endif
endif
` line two y end
if l2ye =< 0
l2ye = 0
l2y_speed = l2y_speed * -1
else
if l2ye => height -1
l2ye = height -1
l2y_speed = l2y_speed * -1
endif
endif
return
` *** line 3 blue move ***
l3_move:
l3xs=l3xs + l3xspeed
l3ys=l3ys + l3yspeed
l3xe=l3xe - l3x_speed
l3ye=l3ye - l3y_speed
blue
` line three x start
line l3xs,l3ys,l3xe,l3ye
white
circle l3xs,l3ys,5
red
circle l3xe,l3ye,5
if l3xs =< 0
l3xs = 0
l3xspeed = l3xspeed * -1
else
if l3xs => width -1
l3xs = width -1
l3xspeed = l3xspeed * -1
endif
endif
` line three y start
if l3ys =< 0
l3ys = 0
l3yspeed = l3yspeed * -1
else
if l3ys => height -1
l3ys = height -1
l3yspeed = l3yspeed * -1
endif
endif
` line three x end
if l3xe =< 0
l3xe = 0
l3x_speed = l3x_speed * -1
else
if l3xe => width -1
l3xe = width -1
l3x_speed = l3x_speed * -1
endif
endif
` line three y end
if l3ye =< 0
l3ye = 0
l3y_speed = l3y_speed * -1
else
if l3ye => height -1
l3ye = height -1
l3y_speed = l3y_speed * -1
endif
endif
return
` *** set up ***
setup:
` line 1
l1xs=rnd(width -1)
l1ys=rnd(height -1)
l1xe=rnd(width -1)
l1ye=rnd(height -1)
l1xspeed=6
l1yspeed=5
l1x_speed=5
l1y_speed=6
` line 2
l2xs=rnd(width -1)
l2ys=rnd(height -1)
l2xe=rnd(width -1)
l2ye=rnd(height -1)
l2xspeed=5
l2yspeed=6
l2x_speed=6
l2y_speed=5
` line 3
l3xs=rnd(width -1)
l3ys=rnd(height -1)
l3xe=rnd(width -1)
l3ye=rnd(height -1)
l3xspeed=rnd(10 +1)
l3yspeed=rnd(10 +1)
l3x_speed=rnd(10 +1)
l3y_speed=rnd(10 +1)
return
keys:
if mouseclick() = 1 then cls
return
` ***** functions only here *****
function red
ink rgb(250,0,0),0
endfunction
function blue
ink rgb(0,0,250),0
endfunction
function white
ink rgb(250,250,250),0
endfunction
function green
ink rgb(0,250,0),0
endfunction
function black
ink rgb(0,0,0),0
endfunction