Qbasicnews.com

Full Version: ok, need help..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
wanna put an array in a sub i gues, ytf wont this work!!!???

Code:
screen 13
dim a(100) as integer
declare sub xmover(xmov,ymov,a(x))
declare sub xmover2(xmov,ymov,a(x))
dim x as integer

xmov = 1
ymov = 1

do

for i = 1 to 320  
xmover(xmov,ymov,a(x))

x = x + 5

a(x) = 1 + x
a(x) = a(x) + 1

sleep 10
next

for i = 320 to 1 step -1
   xmover2(xmov,ymov,a(x))
   x = x + 5

a(x) = 1 + x
a(x) = a(x) + 1
sleep 10
next
  
loop

sub xmover(xmov,ymov,a(x))
   circle(xmov,ymov),a(x),3
   xmov = xmov + 1
end sub

sub xmover2(xmov,ymov,a(x))
   circle(xmov,ymov),a(x),3
   xmov = xmov - 1
end sub
Try this:
Code:
screen 13
dim a(100) as integer
declare sub xmover(xmov,ymov,a(),x)
declare sub xmover2(xmov,ymov,a(),x)
dim x as integer

xmov = 1
ymov = 1

do

for i = 1 to 320  
xmover(xmov,ymov,a(),x)

x = x + 5

a(x) = 1 + x
a(x) = a(x) + 1

sleep 10
next

for i = 320 to 1 step -1
   xmover2(xmov,ymov,a(),x)
   x = x + 5

a(x) = 1 + x
a(x) = a(x) + 1
sleep 10
next
  
loop

sub xmover(xmov,ymov,a(),x)
   circle(xmov,ymov),a(x),3
   xmov = xmov + 1
end sub

sub xmover2(xmov,ymov,a(),x)
   circle(xmov,ymov),a(x),3
   xmov = xmov - 1
end sub

You should really put in some kind of keyboard check, though, to allow the user to exit. Smile