Awesome... here is my code so far:
REM Project: Hangman
REM ***** Main Source File *****
cls
Set Display Mode 800,600,16
Rem Tells the user they can quit by typing 'quit'
info()
SOP:
cls
rem Displays the Title and the Gallows
title()
ink rgb (187,0,245),1
gallows()
ink rgb (0,187,245),1
rem Reset variables
error = 1
usedlet = 0
cheat = 0
rem Creates an array of 3/4/5 letter words
dim word$(12)
word$(0) = "Dog"
word$(1) = "Leg"
word$(2) = "Zen"
word$(3) = "Foe"
word$(4) = "Dove"
word$(5) = "Deer"
word$(6) = "Wolf"
word$(7) = "Lock"
word$(8) = "Hall"
word$(9) = "Block"
word$(10) = "Fable"
word$(11) = "Feint"
word$(12) = "Bogie"
Rem Randomizes the number being chosen, which represents the words
randomize timer()
num = rnd(12)
rem Stores the selected as 'oword$'
oword$ = word$(num)
tword$ = lower$(oword$)
rem Gives the length of the word
lw = len(oword$)
rem Puts the right amount of spaces under the graphic
if lw = 3
threespace()
else
if lw = 4
fourspace()
else
if lw = 5
fivespace()
endif
endif
endif
rem sets array
dim word$(lw)
for c = 1 to lw
word$(c) = mid$(tword$,c)
next c
rem Receive input form player
Input "Guess ", guess$
rem Allows user to quit
while guess$ <> "quit"
found$ = "no"
rem Validation of guessing
for c = 1 to lw
rem Forces guess$ to be lowercase
guess$ = lower$(guess$)
rem CHEAT!!!!!!!
if guess$ = "it"
cheat =1
text 100,400, oword$
error = 5
head()
body()
lleg()
rleg()
rarm()
larm()
else
if guess$ = word$(c) and c = 1
Rem Letter positioning
if lw = 3
text 300, 370, Upper$(guess$)
else
if lw = 4
text 260, 370, Upper$(guess$)
else
if lw = 5
text 250, 370, Upper$(guess$)
endif
endif
endif
inc usedlet
found$ = "yes"
else
if guess$ = word$(c) and c = 2
Rem Letter positioning
if lw = 3
text 350, 370, guess$
else
if lw = 4
text 310, 370, guess$
else
if lw = 5
text 300, 370, guess$
endif
endif
endif
inc usedlet
found$ = "yes"
else
if guess$ = word$(c) and c = 3
Rem Letter positioning
if lw = 3
text 400, 370, guess$
else
if lw = 4
text 360, 370, guess$
else
if lw = 5
text 350, 370, guess$
endif
endif
endif
inc usedlet
found$ = "yes"
else
if guess$ = word$(c) and c = 4
Rem Letter positioning
if lw = 4
text 410, 370, guess$
else
if lw = 5
text 400, 370, guess$
endif
endif
inc usedlet
found$ = "yes"
else
if guess$ = word$(c) and c = 5
Rem Letter positioning
text 440, 370, guess$
inc usedlet
found$ = "yes"
endif
endif
endif
endif
endif
endif
next c
if found$= "no" and error = 1
head()
error = error + 1
else
if found$= "no" and error = 2
body()
error = error + 1
else
if found$= "no" and error = 3
lleg()
error = error + 1
else
if found$= "no" and error = 4
rarm()
error = error + 1
else
if found$= "no" and error = 5
larm()
error = error + 1
else
if found$= "no" and error = 6
rleg()
error = error + 1
endif
endif
endif
endif
endif
endif
if lw = usedlet and cheat = 0
sleep 1500
cls
for c = 1 to 15
ink rgb(rnd(255),rnd(255),rnd(255)),0
sleep 200
text 300, 200, "WINNER!!!"
text 240, 250, "The word was " +oword$+ "."
next c
goto SOP
else
if lw = usedlet and cheat = 1
sleep 1500
cls
for C = 1 to 15
ink rgb(rnd(255),rnd(255),rnd(255)),0
sleep 200
text rnd(600),rnd(400),"CHEATER!!!"
next C
goto SOP
endif
endif
if error = 7 and cheat = 0
sleep 500
cls
for c = 1 to 15
set text size rnd(42)
ink rgb(rnd(255),rnd(255),rnd(255)),0
sleep 200
text rnd(600),rnd(400),"YOU LOST!!! The word was " +oword$+ "."
next c
goto SOP
else
if error = 7 and cheat = 1
sleep 500
cls
for C = 1 to 15
set text size 42
ink rgb(rnd(255),rnd(255),rnd(255)),0
sleep 200
text 400, 300, "How could you lose??!??"
next C
goto SOP
endif
endif
Input "Guess ", guess$
endwhile
end
function title()
set text font "Chiller"
set text size 36
ink rgb (255,0,0),1
text 200,100, "Welcome to Hangman"
ink rgb (187,187,187),1
text 202,102, "Welcome to Hangman"
endfunction
function Gallows()
line 285,150,400,150
line 400,150,400,350
line 325,350,450,350
line 285,150,285,175
endfunction
function head()
circle 285,190,15
endfunction
function body()
line 285,205,285,260
endfunction
function rleg()
line 285,260,265,275
endfunction
function lleg()
line 285,260,305,275
endfunction
function rarm()
line 285,210,265,225
endfunction
function larm()
line 285,210,305,225
endfunction
function fivespace()
line 240, 400, 265, 400
line 290, 400, 315, 400
line 340, 400, 365, 400
line 390, 400, 415, 400
line 440, 400, 465, 400
endfunction
function fourspace()
line 255, 400, 280, 400
line 305, 400, 330, 400
line 355, 400, 380, 400
line 405, 400, 430, 400
endfunction
function threespace()
line 290, 400, 315, 400
line 345, 400, 370, 400
line 395, 400, 420, 400
endfunction
function info()
hide mouse
randomize timer()
set text size 36
ink rgb(rnd(255),rnd(255),rnd(255)),0
Center text 400, 100, "This is a classic version of Hangman"
ink rgb(rnd(255),rnd(255),rnd(255)),0
Center text 400, 150, "The rules are simple:"
ink rgb(rnd(255),rnd(255),rnd(255)),0
Center text 400, 200, "1: You can guess any letter in either"
Center text 400, 230, "lowercase or uppercase"
ink rgb(rnd(255),rnd(255),rnd(255)),0
Center text 400, 280, "2: When all of the body parts are shown..."
Center text 400, 310, "GAME OVER!"
ink rgb(rnd(255),rnd(255),rnd(255)),0
Center text 400, 360, "3: If you need to quit at any time "
Center text 400, 390, "just type 'quit'"
ink rgb (255, 255, 255),0
set text size 25
text 50, 450, "Press the any key"
set text size 10
ink rgb (87,87,87), 0
text 50, 500, "To cheat t y pe, t y pe it"
wait key
endfunction
Now I just need to work on a way to take out the inputed letters.
rem Make a string for (upper/lower) case letters
alpha$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
alpha$ = Left$(tword$, c-1) + Right$(tword$, len(tword$)-c)
I think that should work, I just don't know the reight area to put it... I think it should be under this:
if lw = usedlet and cheat = 1
Thanks again!