Hey guys I\'m very new to DarkBasic and programming in general. I\'ve created this hangman game and I was wondering if anyone would be able to help me with the overall layout and appearance of the game. When you play the game I have words overlapping with the gallows, so it looks like crap. Can anyone help me clean this up and make it look prettier? Any help is appreciated and feel free to add or remove anything to my code. Thanks!
Rem Project: Hangman Project
Rem Created: Saturday, April 13, 2012
Rem Created: Josh Haberer
Rem ***** Main Source File *****
`Hangman
randomize timer()
startofprogram:
rem variable declaration section
dim wordlist(12) as string
dim itemletters(5) as string
num as integer
gitem as string
li as integer
found as string
Error as integer
guess as string
usedletters as integer
letterguess as integer
rem assignment of value section
wordlist(0) = \"queen\"
wordlist(1) = \"sword\"
wordlist(2) = \"spear\"
wordlist(3) = \"noble\"
wordlist(4) = \"fire\"
wordlist(5) = \"fief\"
wordlist(6) = \"serf\"
wordlist(7) = \"moat\"
wordlist(8) = \"bows\"
wordlist(9) = \"sly\"
wordlist(10) = \"die\"
wordlist(11) = \"oat\"
wordlist(12) = \"spy\"
cls
title()
gallows()
num = rnd(12)
gitem = wordlist(num)
li = len(gitem)
if li = 3
threeSpace()
else
if li = 4
threeSpace()
fourSpace()
else
threeSpace()
fourSpace()
fiveSpace()
endif
endif
for c = 1 to li
itemletters(c) = mid$(gitem, c)
printc itemletters(c)
next c
input \"Guess a letter or press qq to quit: \", guess
while guess<> \"qq\"
found = \"no\"
if guess = itemletters(1)
text 115,380, guess
usedletters = usedletters + 1
found = \"yes\"
endif
if guess = itemletters(2)
text 170,380, guess
usedletters = usedletters + 1
found = \"yes\"
endif
if guess = itemletters(3)
text 215,380, guess
usedletters = usedletters + 1
found = \"yes\"
endif
if guess = itemletters(4)
text 265,380, guess
usedletters = usedletters + 1
found = \"yes\"
endif
if guess = itemletters(5)
text 305, 380, guess
usedletters = usedletters + 1
found = \"yes\"
endif
if usedletters = li
sleep 200
CLS
Winner()
sleep 1000
goto startofprogram
endif
if found = \"no\" and Error = 0
head()
Error = Error +1
else
if found = \"no\" and Error = 1
body()
Error = Error +1
else
if found = \"no\" and Error = 2
rleg()
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
endif
endif
endif
endif
endif
endif
if Error = 6
sleep 200
cls
Lose()
sleep 1000
goto startofprogram
endif
input \"Guess a letter or press QQ to quit: \", guess
endwhile
wait key
end
function title()
set text font \"algerian\"
set text size 48
ink rgb(255, 255, 255), 0
text 120, 40, \"Welcome To Hang-Man!\"
ink rgb(255, 0, 0), 0
text 122, 42, \"Welcome To Hang-Man!\"
set text size normal
ink rgb(255, 0, 0), 0
end
function
function Winner()
set text font \"algerian\"
set text size 45
ink rgb(255,0,0),0
text 200,45, \"You win!!! You win!!!\"
ink rgb (0,0,255),0
text 201,46, \"You win!!! You win!!!\"
endfunction
function Lose()
set text font \"algerian\"
set text size 45
ink rgb(255,0,0),0
text 200,45, \"You Lose!!!\"
ink rgb (0,0,255),0
text 201,46, \"You Lose!!!\"
endfunction
function gallows()
line 200, 100, 200, 320
line 200, 100, 300, 100
line 300, 100, 300, 150
end
function
function head()
circle 300, 160, 10
endfunction
function body()
line 300, 172, 300, 210
endfunction
function rleg()
line 300, 210, 290, 250
endfunction
function lleg()
line 300, 210, 310, 250
endfunction
function rarm()
line 300, 172, 310, 210
endfunction
function larm()
line 300, 172, 290, 210
endfunction
function threeSpace()
line 100, 400, 130, 400
line 150, 400, 180, 400
line 200, 400, 230, 400
end
function
function fourSpace()
line 250, 400, 280, 400
endfunction
function fiveSpace()
line 300, 400, 330, 400
endfunction
function LetterWrong(sLetter$)
bOutput as boolean = 1
for c = 1 to array count(itemletters(0))
if itemletters(c) = sLetter$
bOutput = 0
exit
endif
next c
endfunction bOutput
function HandleError(errors)
inc errors
select errors
case 1
head()
endcase
case 2
body()
endcase
case 3
rleg()
endcase
case 4
lleg()
endcase
case 5
rarm()
endcase
case 6
larm()
endcase
endselect
endfunction errors