I`ve posted before about using these Buzz controllers
Connected to the PC they are a 20 button controller.
The main buzzer on the four hand sets are numbers 0, 5, 10 and 15.
For a test program I have it so a Buzzer can be assigned to 2 to 4 players,
then it just goes to show who has the fastest finger.
(I'm going to try a PC based game with these at some point).
I just want to be more efficient and stuctured with my code before I try anything else.
So if anyone wants to give me pointers or just laugh at it, then go ahead.
rem Buzz Controller
HIDE MOUSE
LOAD SOUND "Buzz.wav",1
`Players Colours
dim colours(4)
colours(1)=RGB(0, 0, 255)
colours(2)=RGB(255, 128, 64)
colours(3)=RGB(0, 255, 64)
colours(4)=RGB(255, 255, 0)
SET TEXT FONT "Arial"
SET TEXT SIZE 48
start:
CLS
input "How many players (2 to 4)? ",many
if many>4 OR many<2
gosub start
endif
TYPE playerinfo
name as string
buzz as integer
endtype
DIM players(many) AS playerinfo
for i= 1 to many
cls
again:
PRINT "Press Buzzer Player ";i;""
do
for j = 0 to 15 STEP 5
if (joystick fire x(j) && 1) = 1
`Checks if Buzzer already in use, doesn't check if it's Player 1
`because none of the buzzers will be in use
if i=1 then gosub name
for k=1 to i-1
if j=players(k).buzz
PRINT "Already in use"
WHILE (joystick fire x(j) && 1) = 1
ENDWHILE
gosub again
ENDIF
next k
gosub name
endif
next j
loop
name:
buzz=j
Input "Name of Player ";i;"? ",name$
players(i).name=name$
players(i).buzz=buzz
next i
cls
for i=1 to many
PRINT "Player ";i;": ";players(i).name
next i
INPUT "Is this right (Y/N)?"; continue$
IF continue$="n" THEN gosub start
IF continue$="N" THEN gosub start
fastest:
set text opaque
cls
ink -1,0
SET TEXT SIZE 48
CENTER TEXT 640,488,"Fingers on Buzzers"
do
for k = 0 to 19
for l=1 to many
if (joystick fire x(k) && 1) = 1 AND k=players(l).buzz
PLAY SOUND 1
cls
SET TEXT SIZE 192
ink -1, colours(l)
CENTER TEXT 640,418,players(l).name
WAIT KEY
GOSUB fastest
endif
next l
next k
loop
Please help I'm stupid.