4 Letter Hangman
#6
Hi Phil, I'm glad you and your family like this game. I just added the LCASE$ to it after reading your post. I forgot all about this command, thank you! I also just made a 5 Letter Hangman that I will post in a few minutes. But first I want to give the update to the 4 letter one here. The 5 letter one will be in its own forum topic. I only needed the one line after INKEY$ to convert all key presses to lower case, because all of the words in the DATA statements are in lower case already.

Code: (Select All)
'4 Letter Hangman by SierraKen - August 28, 2022.
'The game chooses between 500 4-letter words.

_Title "4 Letter Hangman by Sierraken"
start:
Cls
Screen _NewImage(800, 600, 32)
Line (0, 400)-(800, 400), _RGB32(255, 255, 255)
Line (600, 400)-(600, 100), _RGB32(255, 255, 255)
Line (600, 100)-(400, 100), _RGB32(255, 255, 255)
Line (400, 100)-(400, 180), _RGB32(255, 255, 255)

For lines = 303 To 453 Step 50
    Line (lines, 500)-(lines + 10, 500), _RGB32(255, 255, 255)
Next lines
Randomize Timer
word = Int(Rnd * 500) + 1
For w = 1 To word - 1
    Read w$
Next w
Read word$
letter1$ = Mid$(word$, 1, 1)
letter2$ = Mid$(word$, 2, 1)
letter3$ = Mid$(word$, 3, 1)
letter4$ = Mid$(word$, 4, 1)

letter = 0: oldletter = 0: one = 0: two = 0: three = 0: four = 0
mistake = 0
go:
Do
    _Limit 20
    a$ = InKey$
    If a$ <> "" Then GoTo continue:
Loop

continue:
a$ = LCase$(a$)
If a$ = Chr$(27) Then End
oldletter = letter
If a$ = letter1$ Then
    _PrintString (305, 480), a$
    For snd = 200 To 700 Step 100
        Sound snd, .5
    Next snd
    one = one + 1
    If one = 1 Then letter = letter + 1
    If letter = 4 Then GoTo won:
End If
If a$ = letter2$ Then
    _PrintString (355, 480), a$
    For snd = 200 To 700 Step 100
        Sound snd, .5
    Next snd
    two = two + 1
    If two = 1 Then letter = letter + 1
    If letter = 4 Then GoTo won:
End If
If a$ = letter3$ Then
    _PrintString (405, 480), a$
    For snd = 200 To 700 Step 100
        Sound snd, .5
    Next snd
    three = three + 1
    If three = 1 Then letter = letter + 1
    If letter = 4 Then GoTo won:
End If
If a$ = letter4$ Then
    _PrintString (455, 480), a$
    For snd = 200 To 700 Step 100
        Sound snd, .5
    Next snd
    four = four + 1
    If four = 1 Then letter = letter + 1
    If letter = 4 Then GoTo won:
End If

If oldletter <> letter Then GoTo go:

mistake = mistake + 1

'Head
If mistake = 1 Then
    Circle (400, 200), 20, _RGB32(255, 255, 255)
    _PrintString (50, 450), a$
    Sound 200, .5
    Sound 600, .5
End If

'Body
If mistake = 2 Then
    Line (400, 220)-(400, 300), _RGB32(255, 255, 255)
    _PrintString (75, 450), a$
    Sound 200, .5
    Sound 600, .5
End If

'Left Arm
If mistake = 3 Then
    Line (400, 240)-(375, 220), _RGB32(255, 255, 255)
    _PrintString (100, 450), a$
    Sound 200, .5
    Sound 600, .5
End If

'Right Arm
If mistake = 4 Then
    Line (400, 240)-(425, 220), _RGB32(255, 255, 255)
    _PrintString (125, 450), a$
    Sound 200, .5
    Sound 600, .5
End If

'Left Leg
If mistake = 5 Then
    Line (400, 300)-(370, 330), _RGB32(255, 255, 255)
    _PrintString (150, 450), a$
    Sound 200, .5
    Sound 600, .5
End If

'Right Leg
If mistake = 6 Then
    Line (400, 300)-(430, 330), _RGB32(255, 255, 255)
    _PrintString (50, 475), a$
    Sound 200, .5
    Sound 600, .5
End If

'Eyes
If mistake = 7 Then
    Circle (390, 190), 3, _RGB32(255, 255, 255)
    Circle (410, 190), 3, _RGB32(255, 255, 255)
    _PrintString (75, 475), a$
    Sound 200, .5
    Sound 600, .5
End If

'Nose
If mistake = 8 Then
    Circle (400, 200), 3, _RGB32(255, 255, 255)
    _PrintString (100, 475), a$
    Sound 200, .5
    Sound 600, .5
End If

'Mouth
If mistake = 9 Then
    Circle (400, 212), 8, _RGB32(255, 255, 255), , , .5
    _PrintString (125, 475), a$
    For snd = 700 To 100 Step -50
        Sound snd, .5
    Next snd
    _PrintString (305, 480), letter1$
    _PrintString (355, 480), letter2$
    _PrintString (405, 480), letter3$
    _PrintString (455, 480), letter4$
    _PrintString (305, 415), "You Lose!"
    Locate 29, 38: Input "Again (Y/N)"; ag$
    If Mid$(ag$, 1, 1) = "y" Or Mid$(ag$, 1, 1) = "Y" Then
        Restore
        GoTo start:
    End If
    End
End If
GoTo go:

won:
_PrintString (305, 415), "You Win!"
Locate 29, 38: Input "Again (Y/N)"; ag$
If Mid$(ag$, 1, 1) = "y" Or Mid$(ag$, 1, 1) = "Y" Then
    Restore
    GoTo start:
End If
End

Data able,acid,aged,also,area,army,away,baby,back,ball
Data band,bank,base,bath,bear,beat,been,beer,bell,belt
Data best,bill,bird,blow,blue,boat,body,bomb,bond,bone
Data book,boom,born,boss,both,bowl,bulk,burn,bush,busy
Data call,calm,came,camp,card,care,case,cash,cast,cell
Data chat,chip,city,club,coal,coat,code,cold,come,cook
Data cool,cope,copy,CORE,cost,crew,crop,dark,data,date
Data dawn,days,dead,deal,dean,dear,debt,deep,deny,desk
Data dial,dick,diet,disc,disk,does,done,door,dose,down
Data draw,drew,drop,drug,dual,duke,dust,duty,each,earn
Data ease,east,easy,edge,else,even,ever,evil,exit,face
Data fact,fail,fair,fall,farm,fast,fate,fear,feed,feel
Data feet,fell,felt,file,fill,film,find,fine,fire,firm
Data fish,five,flat,flow,food,foot,ford,form,fort,four
Data free,from,fuel,full,fund,gain,game,gate,gave,gear
Data gene,gift,girl,give,glad,goal,goes,gold,Golf,gone
Data good,gray,grew,grey,grow,gulf,hair,half,hall,hand
Data hang,hard,harm,hate,have,head,hear,heat,held,hell
Data help,here,hero,high,hill,hire,hold,hole,holy,home
Data hope,host,hour,huge,hung,hunt,hurt,idea,inch,into
Data iron,item,jack,jane,jean,john,join,jump,jury,just
Data keen,keep,kent,kept,kick,kill,kind,king,knee,knew
Data know,lack,lady,laid,lake,land,lane,last,late,lead
Data left,less,life,lift,like,line,link,list,live,load
Data loan,lock,logo,long,look,lord,lose,loss,lost,love
Data luck,made,mail,main,make,male,many,Mark,mass,matt
Data meal,mean,meat,meet,menu,mere,mike,mile,milk,mill
Data mind,mine,miss,mode,mood,moon,more,most,move,much
Data must,name,navy,near,neck,need,news,next,nice,nick
Data nine,none,nose,note,okay,once,only,onto,open,oral
Data over,pace,pack,page,paid,pain,pair,palm,park,part
Data pass,past,path,peak,pick,pink,pipe,plan,play,plot
Data plug,plus,poll,pool,poor,port,post,pull,pure,push
Data race,rail,rain,rank,rare,rate,read,real,rear,rely
Data rent,rest,rice,rich,ride,ring,rise,risk,road,rock
Data role,roll,roof,room,root,rose,rule,rush,ruth,safe
Data said,sake,sale,salt,same,sand,save,seat,seed,seek
Data seem,seen,self,sell,send,sent,sept,ship,shop,shot
Data show,shut,sick,side,sign,site,size,skin,slip,slow
Data snow,soft,soil,sold,sole,some,song,soon,sort,soul
Data spot,star,stay,step,stop,such,suit,sure,take,tale
Data talk,tall,tank,tape,task,team,tech,tell,tend,term
Data test,text,than,that,them,then,they,thin,this,thus
Data till,time,tiny,told,toll,tone,tony,took,tool,tour
Data town,tree,trip,true,tune,turn,twin,type,unit,upon
Data used,user,vary,vast,very,vice,view,vote,wage,wait
Data wake,walk,wall,want,ward,warm,wash,wave,ways,weak
Data wear,week,well,went,were,west,what,when,whom,wide
Data wife,wild,will,wind,wine,wing,wire,wise,wish,with
Data wood,word,wore,work,yard,yeah,year,your,zero,zone
Reply


Messages In This Thread
4 Letter Hangman - by SierraKen - 08-28-2022, 11:02 PM
RE: 4 Letter Hangman - by bplus - 08-28-2022, 11:43 PM
RE: 4 Letter Hangman - by SierraKen - 08-28-2022, 11:56 PM
RE: 4 Letter Hangman - by SierraKen - 08-29-2022, 12:03 AM
RE: 4 Letter Hangman - by PhilOfPerth - 08-29-2022, 05:27 AM
RE: 4 Letter Hangman - by SierraKen - 08-29-2022, 06:00 AM



Users browsing this thread: 2 Guest(s)