When i run this
set display mode 320,240,32
sync on:sync rate 200
hide mouse
set text font timesnewroman$
set text size 12
dim x(1000)
dim y(1000)
dim done(4)
dim x2(1000)
dim y2(1000)
dim done2(4)
dim bx(5)
dim by(5)
gosub box
cls
length=50
length2=50
DO
round=round+1
end=0
length=50+(score*2)
length2=50+(score2*2)
for n=1 to 1000
x(n)=1
y(n)=100
x2(n)=316
y2(n)=140
next n
x=1
y=100
direction=2
x2=316
y2=140
direction2=4
got=0
gosub rndb
sleep 1000
for n=3 to 1 step -1
ink rgb(0,200,0),0
box 0,0,319,239
ink rgb(0,0,0),0
box 1,1,316,238
set text size 12
ink rgb(80,0,0),0
text 12,3, "RED:"+str$(score)
ink rgb(0,0,80),0
text 274,3, "BLUE:"+str$(score2)
if round=6 then goto winner
set text size 20
ink rgb(110,0,110),0
text 143,96, str$(n)
sleep 1000:cls
next n
set text size 12
WHILE forever=0
ink rgb(0,200,0),0
box 0,0,319,239
ink rgb(0,0,0),0
box 1,1,316,238
if legth>1000 then length=1000
if legth2>1000 then length2=1000
ink rgb(200,0,0),0
for n=1 to length
dot x(n),y(n)
next n
ink rgb(0,0,200),0
for n=1 to length2
dot x2(n),y2(n)
next n
ink rgb(80,0,0),0
text 12,3, "RED:"+str$(score)
ink rgb(0,0,80),0
text 274,3, "BLUE:"+str$(score2)
for n=1 to 5
paste image n,bx(n),by(n)
next n
gosub movement
gosub movement2
for n=length to 2 step -1
x(n)=x(n-1)
y(n)=y(n-1)
next n
for n=length2 to 2 step -1
x2(n)=x2(n-1)
y2(n)=y2(n-1)
next n
x(1)=x
y(1)=y
x2(1)=x2
y2(1)=y2
gosub collision
gosub collision2
if end=1 then exit
if got=5
sleep 1500
exit
endif
sync:cls
ENDWHILE
LOOP
END
` ~SUB~
Movement:
rk=keystate(32)
lk=keystate(30)
uk=keystate(17)
dk=keystate(31)
`1=up|2=right|3=down|4=left
olddirection=direction
if Uk=1 and Rk=0 and Dk=0 and Lk=0 then done(1)=0
if Rk=1 and Uk=0 and Dk=0 and Lk=0 then done(2)=0
if Dk=1 and Rk=0 and Uk=0 and Lk=0 then done(3)=0
if Lk=1 and Dk=0 and Rk=0 and Uk=0 then done(4)=0
if Uk=0 and done(1)=1 then done(1)=0
if Rk=0 and done(2)=1 then done(2)=0
if Dk=0 and done(3)=1 then done(3)=0
if Lk=0 and done(4)=1 then done(4)=0
if Uk=1 and done(1)=0 and direction<>3 then direction=1:done(1)=1:goto done
if Rk=1 and done(2)=0 and direction<>4 then direction=2:done(2)=1:goto done
if Dk=1 and done(3)=0 and direction<>1 then direction=3:done(3)=1:goto done
if Lk=1 and done(4)=0 and direction<>2 then direction=4:done(4)=1:goto done
done:
if direction=1
y=y-1
endif
if direction=2
x=x+1
endif
if direction=3
y=y+1
endif
if direction=4
x=x-1
endif
if x=0 then x=x+316
if x=317 then x=x-316
if y=0 then y=y+238
if y=239 then y=y-238
Return
Movement2:
rk=rightkey()
lk=leftkey()
uk=upkey()
dk=downkey()
`1=up|2=right|3=down|4=left
olddirection2=direction2
if Uk=1 and Rk=0 and Dk=0 and Lk=0 then done2(1)=0
if Rk=1 and Uk=0 and Dk=0 and Lk=0 then done2(2)=0
if Dk=1 and Rk=0 and Uk=0 and Lk=0 then done2(3)=0
if Lk=1 and Dk=0 and Rk=0 and Uk=0 then done2(4)=0
if Uk=0 and done2(1)=1 then done2(1)=0
if Rk=0 and done2(2)=1 then done2(2)=0
if Dk=0 and done2(3)=1 then done2(3)=0
if Lk=0 and done2(4)=1 then done2(4)=0
if Uk=1 and done2(1)=0 and direction2<>3 then direction2=1:done2(1)=1:goto done2
if Rk=1 and done2(2)=0 and direction2<>4 then direction2=2:done2(2)=1:goto done2
if Dk=1 and done2(3)=0 and direction2<>1 then direction2=3:done2(3)=1:goto done2
if Lk=1 and done2(4)=0 and direction2<>2 then direction2=4:done2(4)=1:goto done2
done2:
if direction2=1
y2=y2-1
endif
if direction2=2
x2=x2+1
endif
if direction2=3
y2=y2+1
endif
if direction2=4
x2=x2-1
endif
if x2=0 then x2=x2+316
if x2=317 then x2=x2-316
if y2=0 then y2=y2+238
if y2=239 then y2=y2-238
Return
Collision:
for n=2 to length
if x(1)=x(n) and y(1)=y(n)
ink rgb(200,0,200),0
sleep 1500
score2=score2+5*(5-got)
end=1
endif
next n
for n=2 to length2
if x(1)=x2(n) and y(1)=y2(n)
ink rgb(200,0,200),0
sleep 1500
score2=score2+5*(5-got)
end=1
endif
next n
for n=1 to 5
if x>=bx(n) and y>=by(n) and x<=bx(n)+3 and y<=by(n)+3
length=length+10
score=score+5
bx(n)=-1000:got=got+1
endif
next n
Return
Collision2:
for n=2 to length2
if x2(1)=x2(n) and y2(1)=y2(n)
sleep 1500
score=score+5*(5-got)
end=1
endif
next n
for n=2 to length
if x2(1)=x(n) and y2(1)=y(n)
sleep 1500
score=score+5*(5-got)
end=1
endif
next n
for n=1 to 5
if x2>=bx(n) and y2>=by(n) and x2<=bx(n)+3 and y2<=by(n)+3
length2=length2+10
score2=score2+5
bx(n)=-1000:got=got+1
endif
next n
Return
Rndb:
For n=1 to 5
WHILE forever=0
bx(n)=rnd(300)+10
same=0
for z=1 to 5
if z<>n
if bx(n)>=bx(z) and bx(n)<=bx(z)+10 then same=1
endif
next z
if same=0 then exit
ENDwhile
Next n
For n=1 to 5
WHILE forever=0
by(n)=rnd(210)+10
same=0
for z=1 to 5
if z<>n
if by(n)>=by(z) and by(n)<=by(z)+10 then same=1
endif
next z
if same=0 then exit
ENDwhile
Next n
Return
Box:
ink rgb(255,128,0),0
box 0,0,2,2
ink rgb(233,133,0),0
box 1,1,2,2
ink rgb(223,143,0),0
line 0,3, 3,3
line 3,0, 3,3
for n=1 to 5
get image n,0,0,4,4
next n
Return
Winner:
set text size 50
ink rgb(110,0,110),0
if score=score2 then text 80,95, "DRAW"
if score>score2
ink rgb(225,0,0),0
text 25,95, "RED WINS!"
endif
if score<score2
ink rgb(0,0,225),0
text 22,95, "BLUE WINS!"
endif
wait key
END
Return
in DB it works fine but when I make a executeable it's slower and the text size is all messed up.why?
If at first you don't succeed-Pause-Go to last checkpoint