Hangman 2 - SierraKen - 08-14-2024
It chooses one out of 1000 common words. It starts when you run it. Just keep choosing letters to see if you can complete the word before your entire person is made. Capital letters are automatically turned off because they are not used. Enjoy!
Code: (Select All)
'Hangman 2 by SierraKen - August 30, 2022.
'Thanks to B+ for some guidance and OldMoses for a better looking gallows.
'----------------------------------------------------------------------------------------------------
'Feel free to add or subtract any words from the DATA lines with letter amounts two to twelve.
'If you accidentally add a word larger than 12 letters or smaller than 2 letters, it will not use it.
'Also if you accidentally add a word with a capital letter or a symbol, it won't use that either.
'1000 common words comes with this on the DATA lines of different sizes.
_Title "Hangman 2 by Sierraken - Choose A Letter"
Randomize Timer ' <<< once up here is all that is needed
Do
On Error GoTo readagain:
Read words$
w = w + 1
Loop
readagain:
Restore ManyWords:
Dim words$(w)
For a = 1 To w
Read words$(a)
Next a
Dim letter$(30), letter2$(30)
start:
Cls
Screen _NewImage(800, 600, 32)
'Sky
For y = 0 To 400
c = c + .5
Line (0, y)-(800, y), _RGB32(0, 0, c)
Next y
c = 0
'Grass
For y = 401 To 600
c = c + .5
Line (0, y)-(800, y), _RGB32(0, c, 0)
Next y
c = 0
'Tumbleweeds
For weeds = 50 To 500 Step 100
For seconds = 0 To 15 Step 4
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 60) + weeds
y = Int(Cos(s / 180 * 3.141592) * 60) + 401
For b = .7 To -.7 Step -.1
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 216, 127)
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 216, 127)
Next b
Next seconds
For seconds = 45 To 60 Step 4
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 60) + weeds
y = Int(Cos(s / 180 * 3.141592) * 60) + 401
For b = .7 To -.7 Step -.1
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 216, 127)
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 216, 127)
Next b
Next seconds
Next weeds
For weeds = 50 To 500 Step 100
For seconds = 0 To 15 Step 2
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 30) + weeds
y = Int(Cos(s / 180 * 3.141592) * 30) + 401
For b = .5 To -.5 Step -.1
Line (weeds + b, 401)-(x + b, y), _RGB32(0, 255, 0)
Line (weeds + b, 401)-(x + b, y), _RGB32(0, 255, 0)
Next b
Next seconds
For seconds = 45 To 60 Step 2
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 30) + weeds
y = Int(Cos(s / 180 * 3.141592) * 30) + 401
For b = .5 To -.5 Step -.1
Line (weeds + b, 401)-(x + b, y), _RGB32(0, 255, 0)
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 255, 0)
Next b
Next seconds
Next weeds
weeds = 725
For seconds = 0 To 15 Step 4
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 60) + weeds
y = Int(Cos(s / 180 * 3.141592) * 60) + 401
For b = .7 To -.7 Step -.1
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 216, 127)
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 216, 127)
Next b
Next seconds
For seconds = 45 To 60 Step 4
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 60) + weeds
y = Int(Cos(s / 180 * 3.141592) * 60) + 401
For b = .7 To -.7 Step -.1
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 216, 127)
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 216, 127)
Next b
Next seconds
For seconds = 0 To 15 Step 2
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 30) + weeds
y = Int(Cos(s / 180 * 3.141592) * 30) + 401
For b = .5 To -.5 Step -.1
Line (weeds + b, 401)-(x + b, y), _RGB32(0, 255, 0)
Line (weeds + b, 401)-(x + b, y), _RGB32(0, 255, 0)
Next b
Next seconds
For seconds = 45 To 60 Step 2
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 30) + weeds
y = Int(Cos(s / 180 * 3.141592) * 30) + 401
For b = .5 To -.5 Step -.1
Line (weeds + b, 401)-(x + b, y), _RGB32(0, 255, 0)
Line (weeds + b, 401)-(x + b, y), _RGB32(61, 255, 0)
Next b
Next seconds
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)
'a little beefier carpentry - from OldMoses
For beam% = 0 To 19
If beam% Mod 2 = 0 Then c~& = &HFF964B00 Else c~& = &HFF7F7F7F
Line (600 - beam%, 400)-(600 - beam%, 100 + beam%), c~& 'vertical post
Line (600 - beam%, 100 + beam%)-(400 + beam, 100 + beam%), c~& 'horizontal post
Next beam%
Line (550, 400)-(630, 375), _RGB32(255, 255, 255), BF
randword:
word$ = words$(Int(Rnd * w) + 1)
l = Len(word$)
If l > 12 Or l < 2 Then GoTo randword:
For lines = 203 To 203 + ((l - 1) * 50) Step 50
Line (lines - 5, 505)-(lines + 15, 475), _RGB32(255, 255, 255), BF
Line (lines, 500)-(lines + 10, 500), _RGB32(0, 0, 0)
Next lines
Line (40, 440)-(160, 505), _RGB32(255, 255, 255), BF
For ll = 1 To l
letter$(ll) = Mid$(word$, ll, 1)
If Asc(letter$(ll)) < 97 Or Asc(letter$(ll)) > 122 Then GoTo start:
letter2$(ll) = letter$(ll)
Next ll
letter = 0: oldletter = 0
mistake = 0: t = 1
Color _RGB32(0, 0, 0), _RGB32(255, 255, 255)
go:
g = 0
Do
_Limit 20
a$ = InKey$
If a$ <> "" Then GoTo continue:
Loop
continue:
a$ = LCase$(a$)
If a$ = Chr$(27) Then End
t = t + 1
oldletter = letter
For ll = 1 To l
If a$ = letter$(ll) Then
If g < 1 Then letter$(ll) = ""
g = 1
letter = letter + 1
_PrintString (205 + (ll - 1) * 50, 480), a$
For snd = 200 To 700 Step 100
Sound snd, .5
Next snd
If letter = l Then GoTo won:
End If
Next ll
If oldletter <> letter Then GoTo go:
mistake = mistake + 1
'Head
If mistake = 1 Then
For sz = .25 To 20 Step .25
Circle (400, 200), sz, _RGB32(194, 127, 127)
Next sz
_PrintString (50, 450), a$
Sound 200, .5
Sound 600, .5
End If
'Body
If mistake = 2 Then
Line (395, 220)-(405, 240), _RGB32(194, 127, 127), BF
For sz = .25 To 40 Step .25
Circle (400, 270), sz, _RGB32(61, 216, 127), , , 1.85
Next sz
_PrintString (75, 450), a$
Sound 200, .5
Sound 600, .5
End If
'Left Arm
If mistake = 3 Then
seconds = 55
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 60) + 390
y = Int(Cos(s / 180 * 3.141592) * 60) + 240
For b = 5 To -5 Step -.1
Line (390 + b, 240)-(x + b, y), _RGB32(61, 216, 127)
Line (390 + b, 240)-(x + b, y), _RGB32(61, 216, 127)
Next b
For sz = .25 To 6.5 Step .25
Circle (x + 1, y), sz, _RGB32(194, 127, 127), 2 * _Pi, _Pi
Next sz
_PrintString (100, 450), a$
Sound 200, .5
Sound 600, .5
End If
'Right Arm
If mistake = 4 Then
seconds = 5
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 60) + 410
y = Int(Cos(s / 180 * 3.141592) * 60) + 240
For b = 5 To -5 Step -.1
Line (410 + b, 240)-(x + b, y), _RGB32(61, 216, 127)
Line (410 + b, 240)-(x + b, y), _RGB32(61, 216, 127)
Next b
For sz = .25 To 6.5 Step .25
Circle (x - 1, y), sz, _RGB32(194, 127, 127), 2 * _Pi, _Pi
Next sz
_PrintString (125, 450), a$
Sound 200, .5
Sound 600, .5
End If
'Left Leg
If mistake = 5 Then
seconds = 35
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 60) + 390
y = Int(Cos(s / 180 * 3.141592) * 60) + 290
For b = 5 To -5 Step -.1
Line (390 + b, 290)-(x + b, y), _RGB32(61, 216, 127)
Line (390 + b, 290)-(x + b, y), _RGB32(61, 216, 127)
Next b
For sz = .25 To 6.5 Step .25
Circle (x + 1, y), sz, _RGB32(194, 127, 127), _Pi, 2 * _Pi
Next sz
_PrintString (150, 450), a$
Sound 200, .5
Sound 600, .5
End If
'Right Leg
If mistake = 6 Then
seconds = 25
s = (60 - seconds) * 6 + 180
x = Int(Sin(s / 180 * 3.141592) * 60) + 410
y = Int(Cos(s / 180 * 3.141592) * 60) + 290
For b = 5 To -5 Step -.1
Line (410 + b, 290)-(x + b, y), _RGB32(61, 216, 127)
Line (410 + b, 290)-(x + b, y), _RGB32(61, 216, 127)
Next b
For sz = .25 To 6.5 Step .25
Circle (x, y), sz, _RGB32(194, 127, 127), _Pi, 2 * _Pi
Next sz
_PrintString (50, 475), a$
Sound 200, .5
Sound 600, .5
End If
'Eyes
If mistake = 7 Then
For sz = .25 To 3 Step .25
Circle (390, 190), sz, _RGB32(255, 255, 255)
Circle (410, 190), sz, _RGB32(255, 255, 255)
Next sz
For sz = .25 To 1.75 Step .25
Circle (390, 190), sz, _RGB32(0, 161, 255)
Circle (410, 190), sz, _RGB32(0, 161, 255)
Next sz
For sz = .25 To 1 Step .25
Circle (390, 190), sz, _RGB32(0, 0, 0)
Circle (410, 190), sz, _RGB32(0, 0, 0)
Next sz
_PrintString (75, 475), a$
Sound 200, .5
Sound 600, .5
End If
'Nose
If mistake = 8 Then
For sz = .25 To 3 Step .25
Circle (400, 200), sz, _RGB32(78)
Next sz
_PrintString (100, 475), a$
Sound 200, .5
Sound 600, .5
End If
'Mouth
If mistake = 9 Then
For sz = .25 To 8 Step .25
Circle (400, 212), sz, _RGB32(0, 0, 0), , , .5
Next sz
_PrintString (125, 475), a$
For snd = 700 To 100 Step -50
Sound snd, .5
Next snd
For ll = 1 To l
_PrintString (205 + (ll - 1) * 50, 480), letter2$(ll)
Next ll
_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
GoTo start:
End If
End
End If
GoTo go:
won:
_PrintString (305, 415), " You Win! "
For s = 1 To 2
For snd = 100 To 800 Step 100
Sound snd, .5
Next snd
Next s
Locate 29, 38: Input " Again (Y/N) "; ag$
If Mid$(ag$, 1, 1) = "y" Or Mid$(ag$, 1, 1) = "Y" Then
GoTo start:
End If
End
'Almost all of the following words were found here: https://www.ef.edu/english-resources/english-vocabulary/top-1000-words/
ManyWords:
Data ability,able,about,above,accept,according,account,across,act,action
Data activity,actually,add,address,administration,admit,adult,affect,after,again
Data against,age,agency,agent,ago,agree,agreement,ahead,air,all
Data allow,almost,alone,along,already,also,although,always,among,amount
Data analysis,and,animal,another,answer,any,anyone,anything,appear,apply
Data approach,area,argue,arm,around,arrive,art,article,artist,as
Data ask,assume,at,attack,attention,attorney,audience,author,authority,available
Data avoid,away,baby,back,bad,bag,ball,bank,bar,base
Data be,bear,beat,beautiful,because,become,bed,before,begin,behavior
Data behind,believe,benefit,best,better,between,beyond,big,bill,billion
Data bit,black,blood,blue,board,body,book,born,both,box
Data boy,break,bring,brother,budget,build,building,business,but,buy
Data by,call,camera,campaign,can,cancer,candidate,capital,car,card
Data care,career,carry,case,cat,catch,cause,cell,center,central
Data century,certain,certainly,chair,challenge,chance,change,character,charge,check
Data child,choice,choose,church,citizen,city,civil,claim,class,clear
Data clearly,close,coach,cold,collection,college,color,come,commercial,common
Data community,company,compare,computer,concern,condition,conference,consider,consumer,contain
Data continue,control,cost,could,country,couple,course,court,cover,cow
Data create,crime,cultural,culture,cup,current,customer,cut,dark,data
Data daughter,day,dead,deal,death,debate,decade,decide,decision,deep
Data defense,degree,democratic,describe,design,despite,detail,determine,develop,development
Data die,difference,different,difficult,dinner,dinosaur,direction,director,discover,discuss
Data discussion,disease,do,doctor,dog,door,down,draw,dream,drive
Data drop,drug,during,each,early,east,easy,eat,economic,economy
Data edge,education,effect,effort,eight,either,election,elephant,else,employee
Data end,energy,enjoy,enough,enter,entire,environment,especially,establish,even
Data evening,event,ever,every,everybody,everyone,everything,evidence,exactly,example
Data executive,exist,expect,experience,expert,explain,eye,face,fact,factor
Data fail,fall,family,far,fast,father,fear,federal,feel,feeling
Data few,field,fight,figure,fill,film,final,finally,financial,find
Data fine,finger,finish,fire,firm,first,fish,five,floor,fly
Data focus,follow,food,foot,for,force,foreign,forget,form,former
Data forward,four,free,friend,from,front,full,fund,future,game
Data garden,gas,general,generation,get,girl,give,glass,go,goal
Data good,government,great,green,ground,group,grow,growth,guess,gun
Data guy,hair,half,hand,hang,happen,happy,hard,have,he
Data head,health,hear,heart,heat,heavy,help,her,here,herself
Data high,him,himself,his,history,hit,hold,home,hope,horse
Data hospital,hot,hotel,hour,house,how,however,huge,human,hundred
Data husband,idea,identify,if,image,imagine,impact,important,improve,in
Data include,including,increase,indeed,indicate,individual,industry,information,inside,instead
Data institution,interest,interesting,interview,into,investment,involve,issue,it,item
Data its,itself,job,join,just,keep,key,kid,kill,kind
Data kitchen,know,knowledge,land,language,large,last,late,later,laugh
Data law,lawyer,lay,lead,leader,learn,least,leave,left,leg
Data legal,less,let,letter,level,lie,life,light,like,likely
Data line,list,listen,little,live,local,long,look,lose,loss
Data lot,love,low,machine,magazine,main,maintain,major,majority,make
Data man,manage,management,manager,many,market,marriage,material,matter,may
Data maybe,me,mean,measure,meat,media,medical,meet,meeting,member
Data memory,mention,message,method,middle,might,military,million,mind,minute
Data miss,mission,model,modern,moment,money,month,more,morning,most
Data mother,mouth,move,movement,movie,much,music,must,my,myself
Data name,nation,national,natural,nature,near,nearly,necessary,need,network
Data never,new,news,newspaper,next,nice,night,no,none,nor
Data north,not,note,nothing,notice,now,number,occur,of,off
Data offer,office,officer,official,often,oh,oil,ok,old,on
Data once,one,only,onto,open,operation,opportunity,option,or,order
Data organization,other,others,our,out,outside,over,own,owner,page
Data pain,painting,paper,parent,part,participant,particular,particularly,partner,party
Data pass,past,patient,pattern,pay,peace,people,per,perform,performance
Data perhaps,period,person,personal,phone,physical,pick,picture,piece,pig
Data place,plan,plant,play,player,plot,point,police,policy,political
Data politics,poor,popular,population,position,positive,possible,power,practice,prepare
Data present,president,pressure,pretty,prevent,price,private,probably,problem,process
Data produce,product,production,professional,professor,program,project,property,protect,prove
Data provide,public,pull,purpose,push,put,quality,question,quickly,quite
Data race,radio,raise,range,rate,rather,reach,read,ready,real
Data reality,realize,really,reason,receive,recent,recently,recognize,record,red
Data reduce,reflect,region,relate,relationship,religious,remain,remember,remove,report
Data represent,require,research,resource,respond,response,rest,result,return,reveal
Data rich,right,rise,risk,road,rock,role,room,rule,run
Data safe,same,save,say,scene,school,science,scientist,score,sea
Data season,seat,second,section,security,see,seek,seem,sell,send
Data senior,sense,series,serious,serve,service,set,seven,several,sex
Data sexual,shake,share,she,shoot,short,shot,should,shoulder,show
Data side,sign,significant,similar,simple,simply,since,sing,single,sister
Data sit,site,situation,six,size,skill,skin,small,smile,so
Data social,society,soldier,some,somebody,someone,something,sometimes,son,song
Data soon,sort,sound,source,south,southern,space,speak,special,specific
Data speech,spend,sport,spring,staff,stage,stand,standard,star,start
Data state,statement,station,stay,step,still,stock,stop,store,story
Data strategy,street,strong,structure,student,study,stuff,style,subject,success
Data successful,such,suddenly,suffer,suggest,summer,support,sure,surface,system
Data table,take,talk,task,tax,teach,teacher,team,technology,telephone
Data television,tell,ten,tend,term,test,than,thank,that,the
Data their,them,themselves,then,theory,there,these,they,thing,think
Data third,this,those,though,thought,thousand,threat,three,through,throughout
Data throw,thus,time,to,today,together,tonight,too,top,total
Data tough,toward,town,trade,traditional,training,travel,treat,treatment,tree
Data trial,trip,trouble,truck,true,truth,try,turn,two,type
Data under,understand,unit,until,up,upon,us,use,usually,value
Data various,very,victim,view,violence,visit,voice,vote,wait,walk
Data wall,want,war,watch,water,way,we,weapon,wear,week
Data weight,well,west,western,what,whatever,when,where,whether,which
Data while,white,who,whole,whom,whose,why,wide,wife,will
Data win,wind,window,wish,with,within,without,woman,wonder,word
Data work,worker,world,worry,would,write,writer,wrong,xylophone,yard
Data yeah,year,yes,yet,you,young,your,yourself,zebra,zoo,monotonous
|