`HANGMAN, STARTED 07/12/05
GOSUB SETUP : DO : `MAIN MENU SCREEN (WHERE USER CHOOSES WORD)
GOSUB MAIN_MENU : SYNC : LOOP
`******************************************************************************************************************
WORD1:
LENGTH=7
`SPLIT WORD UP AND DRAW A LINE UNDER EACH LETTER (NOTE; X=SCREEN LENGTH)
LETTER1$="H" : LINE X/2-55,300,X/2-65,300
LETTER2$="A" : LINE X/2-35,300,X/2-45,300
LETTER3$="N" : LINE X/2-15,300,X/2-25,300
LETTER4$="G" : LINE X/2-05,300,X/2+05,300
LETTER5$="M" : LINE X/2+15,300,X/2+25,300
LETTER6$="A" : LINE X/2+35,300,X/2+45,300
LETTER7$="N" : LINE X/2+55,300,X/2+65,300
GOSUB PLAY_GAME
`******************************************************************************************************************
WORD2:
LENGTH=7
`SPLIT WORD UP
LETTER1$="S" : LINE X/2-55,300,X/2-65,300
LETTER2$="P" : LINE X/2-35,300,X/2-45,300
LETTER3$="I" : LINE X/2-15,300,X/2-25,300
LETTER4$="D" : LINE X/2-5,300 ,X/2+5 ,300
LETTER5$="E" : LINE X/2+15,300,X/2+25,300
LETTER6$="R" : LINE X/2+35,300,X/2+45,300
LETTER7$="S" : LINE X/2+55,300,X/2+65,300
GOSUB PLAY_GAME
`******************************************************************************************************************
WORD3:
LENGTH=7
`SPLIT WORD UP
LETTER1$="T" : LINE X/2-55,300,X/2-65,300
LETTER2$="R" : LINE X/2-35,300,X/2-45,300
LETTER3$="A" : LINE X/2-15,300,X/2-25,300
LETTER4$="I" : LINE X/2-5,300 ,X/2+5 ,300
LETTER5$="N" : LINE X/2+15,300,X/2+25,300
LETTER6$="E" : LINE X/2+35,300,X/2+45,300
LETTER7$="R" : LINE X/2+55,300,X/2+65,300
GOSUB PLAY_GAME
`******************************************************************************************************************
WORD4:
LENGTH=7
`SPLIT WORD UP
LETTER1$="T" : LINE X/2-55,300,X/2-65,300
LETTER2$="R" : LINE X/2-35,300,X/2-45,300
LETTER3$="A" : LINE X/2-15,300,X/2-25,300
LETTER4$="C" : LINE X/2-5,300 ,X/2+5 ,300
LETTER5$="T" : LINE X/2+15,300,X/2+25,300
LETTER6$="O" : LINE X/2+35,300,X/2+45,300
LETTER7$="R" : LINE X/2+55,300,X/2+65,300
GOSUB PLAY_GAME
`******************************************************************************************************************
WORD5:
LENGTH=7
`SPLIT WORD UP
LETTER1$="C" : LINE X/2-55,300,X/2-65,300
LETTER2$="A" : LINE X/2-35,300,X/2-45,300
LETTER3$="N" : LINE X/2-15,300,X/2-25,300
LETTER4$="D" : LINE X/2-5,300 ,X/2+5 ,300
LETTER5$="L" : LINE X/2+15,300,X/2+25,300
LETTER6$="E" : LINE X/2+35,300,X/2+45,300
LETTER7$="S" : LINE X/2+55,300,X/2+65,300
GOSUB PLAY_GAME
`******************************************************************************************************************
WORD6:
LENGTH=7
`SPLIT WORD UP
LETTER1$="C" : LINE X/2-55,300,X/2-65,300
LETTER2$="U" : LINE X/2-35,300,X/2-45,300
LETTER3$="S" : LINE X/2-15,300,X/2-25,300
LETTER4$="T" : LINE X/2-5,300 ,X/2+5 ,300
LETTER5$="A" : LINE X/2+15,300,X/2+25,300
LETTER6$="R" : LINE X/2+35,300,X/2+45,300
LETTER7$="D" : LINE X/2+55,300,X/2+65,300
GOSUB PLAY_GAME
`******************************************************************************************************************
WORD7:
LENGTH=7
`SPLIT WORD UP
LETTER1$="K" : LINE X/2-55,300,X/2-65,300
LETTER2$="I" : LINE X/2-35,300,X/2-45,300
LETTER3$="T" : LINE X/2-15,300,X/2-25,300
LETTER4$="C" : LINE X/2-5,300 ,X/2+5 ,300
LETTER5$="H" : LINE X/2+15,300,X/2+25,300
LETTER6$="E" : LINE X/2+35,300,X/2+45,300
LETTER7$="N" : LINE X/2+55,300,X/2+65,300
GOSUB PLAY_GAME
`******************************************************************************************************************
WORD8:
LENGTH=7
`SPLIT WORD UP
LETTER1$="W" : LINE X/2-55,300,X/2-65,300
LETTER2$="A" : LINE X/2-35,300,X/2-45,300
LETTER3$="S" : LINE X/2-15,300,X/2-25,300
LETTER4$="H" : LINE X/2-5,300 ,X/2+5 ,300
LETTER5$="I" : LINE X/2+15,300,X/2+25,300
LETTER6$="N" : LINE X/2+35,300,X/2+45,300
LETTER7$="G" : LINE X/2+55,300,X/2+65,300
GOSUB PLAY_GAME
`******************************************************************************************************************
`**************************
`**START OF SUB FUNCTIONS**
`**************************
HANG:
IF GUESS=1 THEN LINE X/2+200,500,X/2+300,500 : `GROUND
IF GUESS=2 THEN LINE X/2+225,500,X/2+225,400 : `PILLAR
IF GUESS=3 THEN LINE X/2+225,400,X/2+275,400 : LINE X/2+275,400,X/2+275,410 : `TOP
IF GUESS=4 THEN CIRCLE X/2+275,420,10 : `HEAD
IF GUESS=5 THEN LINE X/2+275,430,X/2+275,460 : `BODY
IF GUESS=6 THEN LINE X/2+275,430,X/2+265,440 : `RIGHT ARM
IF GUESS=7 THEN LINE X/2+275,430,X/2+285,440 : `LEFT ARM
IF GUESS=8 THEN LINE X/2+275,460,X/2+265,475 : `RIGHT LEG
IF GUESS=9 THEN LINE X/2+275,460,X/2+285,475 : `LEFT LEG
IF GUESS=10 THEN INK RGB(200,20,20),RGB(0,0,0) : LINE X/2+250,500,X/2+295,500 : `ADD BLOOD
RETURN
`-----------------------------------------------------------------------------------------------------------------
LOST:
CLS : SYNC : INK RGB(255,255,255),RGB(0,0,0)
FOR LOST=1 TO 100
SET CURSOR X/2,280 : PRINT "U LOST"
SYNC : NEXT LOST : END : RETURN
`------------------------------------------------------------------------------------------------------------------
WIN:
IF CORRECT=LENGTH AND GUESS<1 THEN CHEAT=1 : `CHECKS IF PLAYER HAS CHEATED
CLS : INK RGB(255,255,255),RGB(0,0,0)
FOR CORRECT=1 TO 100 : CENTER TEXT X/2,280,"U WIN"
`IF PLAYER HAS PLAYED BEFORE (I.E. IF THEY GET NO LETTERS WRONG) THEN IT SAYS THEY HAVE PLAYED BEFORE
IF CHEAT=1 THEN CENTER TEXT X/2,300,"BUT U'VE PLAYED BEFORE!!!"
SYNC : NEXT CORRECT : CLS : GOSUB MAIN_MENU : RETURN
`------------------------------------------------------------------------------------------------------------------
MAIN_MENU:
LIVES=10 : GUESS=0 : CORRECT=0 : DO
`DISPLAYS LIST OF AVAILABLE WORDS/GAMES
CENTER TEXT X/2,350,"PRESS 1,2,3,4,5,6,7 OR 8 TO SELECT A WORD"
`CHECKS WHICH ONE PLAYER CHOOSES AND STARTS THAT GAME, WAIT IS SO THAT INPUT NUMBER IS NOT MISTAKEN AS A GUESS
IF INKEY$()="1" THEN CLS : WAIT 500 : GOTO WORD1
IF INKEY$()="2" THEN CLS : WAIT 500 : GOTO WORD2
IF INKEY$()="3" THEN CLS : WAIT 500 : GOTO WORD3
IF INKEY$()="4" THEN CLS : WAIT 500 : GOTO WORD4
IF INKEY$()="5" THEN CLS : WAIT 500 : GOTO WORD5
IF INKEY$()="6" THEN CLS : WAIT 500 : GOTO WORD6
IF INKEY$()="7" THEN CLS : WAIT 500 : GOTO WORD7
IF INKEY$()="8" THEN CLS : WAIT 500 : GOTO WORD8
SYNC : LOOP : RETURN
`------------------------------------------------------------------------------------------------------------------
GUESS:
INPUT GUESS$ : `ALLOW USER TO GUESS A LETTER
IF LEN(GUESS$)>1 THEN GUESS$=LEFT$(GUESS$,1) : `MAKE SURE ONLY FIRST LETTER IS ENTERED IS GUESSED
GUESS$=UPPER$(GUESS$) : RETURN : `MAKE SURE GUESS IS IN CAPITALS (OTHERWISE LETTERS WONT MATCH)
`------------------------------------------------------------------------------------------------------------------
INFO:
INK RGB(255,255,255),RGB(0,0,0) : SET CURSOR X/2,500
CENTER TEXT X/2,0,"U HAVE "+STR$(LIVES)+" LIVES TO GUESS THE WORD"
CENTER TEXT X/2,20,"PLEASE ENTER A LETTER TO GUESS AND PRESS ENTER"
CENTER TEXT X/2-200,80,"LETTERS GUESSED SO FAR"
RETURN
`------------------------------------------------------------------------------------------------------------------
SETUP:
SET DISPLAY MODE 1024,768,32 : X=1024 : `SET SCREEN RESOLUTION, AND STORE SCREENS X LENGTH
SYNC ON : HIDE MOUSE : INK RGB(255,255,255),RGB(0,0,0) : RETURN
`------------------------------------------------------------------------------------------------------------------
MATCHING_LETTERS_FOR_7_LETTER_WORD:
`CHECK IF GUESS MATCHES ANY OF THE LETTERS AND DISPLAY IT IN IT'S CORRECT PLACE
IF GUESS$=LETTER1$ THEN CENTER TEXT X/2-60,280,LETTER1$ : INC CORRECT
IF GUESS$=LETTER2$ THEN CENTER TEXT X/2-40,280,LETTER2$ : INC CORRECT
IF GUESS$=LETTER3$ THEN CENTER TEXT X/2-20,280,LETTER3$ : INC CORRECT
IF GUESS$=LETTER4$ THEN CENTER TEXT X/2-0 ,280,LETTER4$ : INC CORRECT
IF GUESS$=LETTER5$ THEN CENTER TEXT X/2+20,280,LETTER5$ : INC CORRECT
IF GUESS$=LETTER6$ THEN CENTER TEXT X/2+40,280,LETTER6$ : INC CORRECT
IF GUESS$=LETTER7$ THEN CENTER TEXT X/2+60,280,LETTER7$ : INC CORRECT
RETURN
`------------------------------------------------------------------------------------------------------------------
INCORRECT_GUESS_FOR_7_LETTER_WORD:
`CHECK IF GUESS DOESN'T MATCH ANY OF THE LETTERS AND ISN'T BLANK
IF GUESS$<>LETTER1$ AND GUESS$<>LETTER2$ AND GUESS$<>LETTER3$ AND GUESS$<>LETTER4$
IF GUESS$<>LETTER5$ AND GUESS$<>LETTER6$ AND GUESS$<>LETTER7$ AND GUESS$<>""
`DISPLAY THE INCORRECT LETTER
INC GUESS : SET CURSOR 200+(GUESS*20),100 : PRINT GUESS$
ENDIF : ENDIF : RETURN
`------------------------------------------------------------------------------------------------------------------
`******************************************************************************************************************
PLAY_GAME:
DO : GOSUB INFO : GOSUB GUESS
GOSUB MATCHING_LETTERS_FOR_7_LETTER_WORD : GOSUB INCORRECT_GUESS_FOR_7_LETTER_WORD : GOSUB HANG
IF GUESS>LIVES-1 THEN GOSUB LOST
IF CORRECT=LENGTH THEN GOSUB WIN
SYNC : LOOP : RETURN
`******************************************************************************************************************
any thoughts/tips on how to make it better would be great.
p.s. i have only tried to make this after reading about a tutorial for dbpro an thought it would be cool to try it, so please don't make any pointless comments about it being a game already in retail.... as i am using it purely to learn from.
life's one big game