I didn't really have a problem with fps...it typically stayed around 200. If you'res is moving around too much, I'd check out your fps while everyones shooting, and then put the sync rate at 5 or 6 under that.
anyways, I made the bullets and white dot move much faster
`setup
hide mouse
sync on
sync rate 210
players=1
while returnkey()=0
set cursor 1,1
if rightkey()=1 then players=2
if leftkey()=1 then players=1
print "Players: "+str$(players)
sync
cls
endwhile
gosub declarations
randomize timer()
restart:
time=timer()
restart2:
`main loop
do
gosub controls
gosub cpublue
gosub cpured
gosub refresh
gosub random
gosub respawn
gosub scoring
gosub timing
sync
cls
loop
timing:
if timer()>=time+1000
time=timer()
dec times
if times=-1
times=59
dec timem
endif
endif
ink rgb (255,255,255),0
if times<10
center text screen width()/2,0,str$(timem)+" : 0"+str$(times)
else
center text screen width()/2,0,str$(timem)+" : "+str$(times)
endif
if timem<=0 and times<=0 then goto winner2
return
`it explains itself
scoring:
ink rgb(255,255,255),0
center text (screen width()/2)-100,0,str$(bluwin)
center text (screen width()/2)+100,0,str$(redwin)
for x=1 to 6
if plyrs(x).xpos=screen width()/2
plyrs(x).reload=10
if x<=3
dec tugchange#,.5
else
inc tugchange#,.5
endif
endif
next x
tug#=tugchange#+tug#
if tugchange#<0 then ink rgb(0,0,255),0
if tugchange#>0 then ink rgb(255,0,0),0
if tugchange#=0 then ink rgb(0,255,0),0
line screen width()/2,0,screen width()/2,screen height()
ink rgb(255,255,255),0
circle (screen width()/2)+tug#,screen height()/2,5
if abs(tug#)>=screen width()/2 then goto winner
tugchange#=0
return
`respawns characters
respawn:
for x=1 to 6
if plyrs(x).respawn=1
respawn=rnd(1)*230
plyrs(x).ypos=125+respawn
if x<=3
plyrs(x).xpos=143
else
plyrs(x).xpos=screen width()-143
endif
plyrs(x).order=0
plyrs(x).respawn=0
endif
next x
return
`controls red computers
cpured:
for x=(3+players) to 6
if plyrs(1).xpos=screen width()/2 or plyrs(2).xpos=screen width()/2 or plyrs(3).xpos=screen width()/2 or plyrs(x).xpos=screen width()
plyrs(x).cmdtime=-1
if plyrs(x).xpos=screen width()/2 then plyrs(x).order=7
if plyrs(1).xpos=screen width()/2 then plyrs(x).order=4
if plyrs(2).xpos=screen width()/2 then plyrs(x).order=5
if plyrs(3).xpos=screen width()/2 then plyrs(x).order=6
else if plyrs(x).cmdtime=-1
plyrs(x).cmdtime=0
endif
endif
if plyrs(x).cmdtime=0
plyrs(x).cmdtime=rnd(4000)+1000
plyrs(x).order=rnd(12)+4
if plyrs(x).order>10 then plyrs(x).order=7
endif
if plyrs(x).cmdtime>0 then dec plyrs(x).cmdtime
select plyrs(x).order
case 4,5,6
if plyrs(x).xpos<(screen width()/2)-50 then movex=1
if plyrs(x).ypos<plyrs(plyrs(x).order-3).ypos then plyrs(x).movey=1
if plyrs(x).ypos>plyrs(plyrs(x).order-3).ypos then plyrs(x).movey=-1
shot=1
endcase
case 7
plyrs(x).movex=-1
if plyrs(1).ypos<plyrs(x).ypos and plyrs(2).ypos<plyrs(x).ypos and plyrs(3).ypos<plyrs(x).ypos then plyrs(x).movey=1
if plyrs(1).ypos>plyrs(x).ypos and plyrs(2).ypos>plyrs(x).ypos and plyrs(3).ypos>plyrs(x).ypos then plyrs(x).movey=-1
if plyrs(x).movey=0 then plyrs(x).movey=-1
endcase
case 8,9,10
if plyrs(x).ypos<(cover(plyrs(x).order-3).y1+cover(plyrs(x).order-6).y2)/2
plyrs(x).movey=1
else
plyrs(x).movey=-1
endif
if plyrs(x).xpos<cover(plyrs(x).order-3).x+7 then plyrs(x).movex=1
if plyrs(x).xpos>cover(plyrs(x).order-3).x+7 then plyrs(x).movex=-1
for i=1 to 3
if plyrs(i).ypos>cover(plyrs(x).order-3).y1+3 and plyrs(i).ypos<cover(plyrs(x).order-3).y2-3
if plyrs(x).ypos<plyrs(i).ypos then plyrs(x).movey=1
if plyrs(x).ypos>plyrs(i).ypos then plyrs(x).movey=-1
shot=1
endif
next i
endcase
endselect
if plyrs(x).movey=-1 and plyrs(x).ypos<2 then plyrs(x).movey=0
if plyrs(x).movey=1 and plyrs(x).ypos>screen height()-2 then plyrs(x).movey=0
if plyrs(x).movex=-1 and plyrs(x).xpos<(screen width()/2)+1 then plyrs(x).movex=0
if plyrs(x).movex=1 and plyrs(x).xpos>screen width()-2 then plyrs(x).movex=0
if shot=1 and plyrs(x).reload=0
plyrs(x).reload=10
inc bulletnum
if bulletnum=372 then bulletnum=1
bullet(bulletnum).dep=1
bullet(bulletnum).color=1
bullet(bulletnum).xpos=plyrs(x).xpos
bullet(bulletnum).ypos=plyrs(x).ypos
endif
if plyrs(x).reload>0 then dec plyrs(x).reload
shot=0
next x
return
`blueteam controls
cpublue:
for x=2 to 3
if plyrs(4).xpos=screen width()/2 or plyrs(5).xpos=screen width()/2 or plyrs(6).xpos=screen width()/2 or plyrs(x).xpos=screen width()
plyrs(x).cmdtime=-1
if plyrs(x).xpos=screen width()/2 then plyrs(x).order=7
if plyrs(4).xpos=screen width()/2 then plyrs(x).order=4
if plyrs(5).xpos=screen width()/2 then plyrs(x).order=5
if plyrs(6).xpos=screen width()/2 then plyrs(x).order=6
else if plyrs(x).cmdtime=-1
plyrs(x).cmdtime=0
endif
endif
if plyrs(x).cmdtime=0
randomize timer()
plyrs(x).cmdtime=rnd(4000)+1000
plyrs(x).order=rnd(12)+4
if plyrs(x).order>10 then plyrs(x).order=7
endif
if plyrs(x).cmdtime>0 then dec plyrs(x).cmdtime
select plyrs(x).order
case 4,5,6
if plyrs(x).xpos<(screen width()/2)-50 then movex=1
if plyrs(x).ypos<plyrs(plyrs(x).order).ypos then plyrs(x).movey=1
if plyrs(x).ypos>plyrs(plyrs(x).order).ypos then plyrs(x).movey=-1
shot=1
endcase
case 7
plyrs(x).movex=1
if plyrs(4).ypos<plyrs(x).ypos and plyrs(5).ypos<plyrs(x).ypos and plyrs(6).ypos<plyrs(x).ypos then plyrs(x).movey=1
if plyrs(4).ypos>plyrs(x).ypos and plyrs(5).ypos>plyrs(x).ypos and plyrs(6).ypos>plyrs(x).ypos then plyrs(x).movey=-1
if plyrs(x).movey=0 then plyrs(x).movey=-1
endcase
case 8,9,10
if plyrs(x).ypos<(cover(plyrs(x).order-6).y1+cover(plyrs(x).order-6).y2)/2
plyrs(x).movey=1
else
plyrs(x).movey=-1
endif
if plyrs(x).xpos<cover(plyrs(x).order-6).x-7 then plyrs(x).movex=1
if plyrs(x).xpos>cover(plyrs(x).order-6).x-7 then plyrs(x).movex=-1
for i=4 to 6
if plyrs(i).ypos>cover(plyrs(x).order-6).y1+3 and plyrs(i).ypos<cover(plyrs(x).order-6).y2-3
if plyrs(x).ypos<plyrs(i).ypos then plyrs(x).movey=1
if plyrs(x).ypos>plyrs(i).ypos then plyrs(x).movey=-1
shot=1
endif
next i
endcase
endselect
if plyrs(x).movey=-1 and plyrs(x).ypos<2 then plyrs(x).movey=0
if plyrs(x).movey=1 and plyrs(x).ypos>screen height()-2 then plyrs(x).movey=0
if plyrs(x).movex=-1 and plyrs(x).xpos<2 then plyrs(x).movex=0
if plyrs(x).movex=1 and plyrs(x).xpos>(screen width()/2)-1 then plyrs(x).movex=0
if shot=1 and plyrs(x).reload=0
plyrs(x).reload=10
inc bulletnum
if bulletnum=372 then bulletnum=1
bullet(bulletnum).dep=1
bullet(bulletnum).color=3
bullet(bulletnum).xpos=plyrs(x).xpos
bullet(bulletnum).ypos=plyrs(x).ypos
endif
if plyrs(x).reload>0 then dec plyrs(x).reload
shot=0
next x
return
`random, needed stuff
random:
if bulletnum>=372 then bulletnum=1
return
`controls players
controls:
if upkey()=1 and plyrs(1).ypos>2 then plyrs(1).movey=-1
if downkey()=1 and plyrs(1).ypos<screen height()-2 then plyrs(1).movey=1
if leftkey()=1 and plyrs(1).xpos>2 then plyrs(1).movex=-1
if rightkey()=1 and plyrs(1).xpos<screen width()/2 then plyrs(1).movex=1
if shiftkey()=1 and plyrs(1).reload=0
plyrs(1).reload=10
inc bulletnum
if bulletnum=372 then bulletnum=1
bullet(bulletnum).dep=1
bullet(bulletnum).color=3
bullet(bulletnum).xpos=plyrs(1).xpos
bullet(bulletnum).ypos=plyrs(1).ypos
endif
if plyrs(1).reload>0 then dec plyrs(1).reload
if players=2
if keystate(17)=1 and plyrs(4).ypos>2 then plyrs(4).movey=-1
if keystate(31)=1 and plyrs(4).ypos<screen height()-2 then plyrs(4).movey=1
if keystate(30)=1 and plyrs(4).xpos>screen width()/2 then plyrs(4).movex=-1
if keystate(32)=1 and plyrs(4).xpos<screen width()-2 then plyrs(4).movex=1
if spacekey()=1 and plyrs(4).reload=0
plyrs(4).reload=10
inc bulletnum
if bulletnum=372 then bulletnum=1
bullet(bulletnum).dep=1
bullet(bulletnum).color=1
bullet(bulletnum).xpos=plyrs(4).xpos
bullet(bulletnum).ypos=plyrs(4).ypos
endif
if plyrs(4).reload>0 then dec plyrs(4).reload
endif
return
`redraws EVERYTHING, manages collision
refresh:
for x=1 to 372
if bullet(x).xpos>1 and bullet(x).xpos<screen width()-1
if bullet(x).dep=1
select bullet(x).color
case 1
ink rgb(255,0,0),0
bullet(x).xpos=bullet(x).xpos-3
for i=1 to 3
if bullet(x).xpos>=cover(i).x and bullet(x).xpos<=cover(i).x+4
if bullet(x).ypos>=cover(i).y1 and bullet(x).ypos<=cover(i).y2
bullet(x).dep=0
endif
endif
if abs(sqrt((bullet(x).xpos-plyrs(i).xpos)^2+(bullet(x).ypos-plyrs(i).ypos)^2))<=3 then plyrs(i).respawn=1
next i
endcase
case 3
ink rgb(0,0,255),0
bullet(x).xpos=bullet(x).xpos+3
for i=4 to 6
if bullet(x).xpos>=cover(i).x and bullet(x).xpos<=cover(i).x+4
if bullet(x).ypos>=cover(i).y1 and bullet(x).ypos<=cover(i).y2
bullet(x).dep=0
endif
endif
if abs(sqrt((bullet(x).xpos-plyrs(i).xpos)^2+(bullet(x).ypos-plyrs(i).ypos)^2))<=3 then plyrs(i).respawn=1
next i
endcase
endselect
circle bullet(x).xpos,bullet(x).ypos,2
endif
endif
next x
for x=1 to pa
if x>1
if x<=3
ink rgb(100,100,255),0
else
ink rgb(255,100,100),0
endif
else
ink rgb(0,255,0),0
endif
if players=2 and x=4 then ink rgb(0,255,0),0
plyrs(x).xpos=plyrs(x).xpos+plyrs(x).movex
plyrs(x).ypos=plyrs(x).ypos+plyrs(x).movey
circle plyrs(x).xpos,plyrs(x).ypos,5
plyrs(x).movex=0
plyrs(x).movey=0
next x
gosub drawlvl
return
`redraws level
drawlvl:
ink rgb(0,255,0),0
line screen width()/2,0,screen width()/2,screen height()
for x=1 to 6
if x<=3
ink rgb(0,0,255),0
else
ink rgb(255,0,0),0
endif
if x=3 or x=6
cover(x).y1=cover(x).y1+cover(x).direct
cover(x).y2=cover(x).y2+cover(x).direct
if cover(x).y1=0 or cover(x).y2=screen height() then cover(x).direct=cover(x).direct*-1
endif
line cover(x).x,cover(x).y1,cover(x).x,cover(x).y2
next x
return
`declares all variables
declarations:
type mngplyrs
xpos as integer
ypos as integer
reload as integer
movex as integer
movey as integer
cmdtime as integer
order as integer
respawn as boolean
endtype
type bullets
xpos as integer
ypos as integer
color as integer
dep as boolean
endtype
type lines
x as integer
y1 as integer
y2 as integer
direct as integer
endtype
#constant pa=6
dim cover(60) as lines
dim bullet(372) as bullets
dim plyrs(pa) as mngplyrs
bulletnum=0
movewait=0
shot=0
respawn=0
tug#=0
match=0
bluwin=0
redwin=0
tugchange#=0
time=0
times=0
timem=5
for x=1 to 3
plyrs(x).xpos=5
plyrs(x).ypos=5
next x
for x=4 to 6
plyrs(x).xpos=screen width()-5
plyrs(x).ypos=screen height()-5
next x
cover(1).x=150
cover(1).y1=100
cover(1).y2=150
cover(2).x=150
cover(2).y1=screen height()-150
cover(2).y2=screen height()-100
cover(3).x=(screen width()/2)-50
cover(3).y1=0
cover(3).y2=50
cover(3).direct=1
cover(4).x=screen width()-150
cover(4).y1=100
cover(4).y2=150
cover(5).x=screen width()-150
cover(5).y1=screen height()-150
cover(5).y2=screen height()-100
cover(6).x=(screen width()/2)+50
cover(6).y1=screen height()-50
cover(6).y2=screen height()
cover(6).direct=-1
return
winner:
ink rgb(255,255,255),0
if tug#<=-50
inc bluwin
else
inc redwin
endif
tug#=0
tugchange#=0
for x=1 to 6
if x<=3
plyrs(x).xpos=5
plyrs(x).ypos=5
else
plyrs(x).xpos=screen width()-5
plyrs(x).ypos=screen height()-5
endif
plyrs(x).reload=0
plyrs(x).movex=0
plyrs(x).movey=0
plyrs(x).cmdtime=0
plyrs(x).order=0
plyrs(x).respawn=0
next x
for x=1 to 372
bullet(x).xpos=0
bullet(x).ypos=0
bullet(x).dep=0
next x
goto restart2
winner2:
while returnkey()=0
cls
center text screen width()/2,0, "Final Score:"
center text (screen width()/2)-100,20, "Blue Team: "+str$(bluwin)
center text (screen width()/2)+100,20, "Red Team: "+str$(redwin)
center text screen width()/2,50,"Press Enter to Play Again, Press Escape to stop."
sync
endwhile
timem=5
times=0
redwin=0
bluwin=0
tug#=0
tugchange#=0
goto restart
five score and seven years ago comes out march 6th. WOOT!