Author Topic: 4 Letter Word Invaders Game  (Read 7947 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
4 Letter Word Invaders Game
« on: February 05, 2022, 08:47:14 pm »
Test your typing skills by typing a random 4 letter word that falls as you type. There are 500 4-letter words that it chooses from. Get 40 right before losing all your lives wins. It's possible the same word is used more than once. Others may have made this game in the past, I'm pretty sure I saw it back in the 90's somewhere. But I thought I would give it a try myself. Each word you type right makes the next one go faster. No need to press the Enter key, it uses INKEY$. I've played a couple times and can only get to 39. Good luck!

Code: QB64: [Select]
  1. '4 Letter Word Invaders Game
  2. 'By SierraKen on Feb. 5, 2022
  3. '
  4. 'Test your typing skills by typing each word that falls. No need press the Enter key.
  5. 'The more you get right, the faster it goes. 40 points wins. Good Luck!
  6.  
  7. Dim a$(600)
  8. For t = 1 To 500
  9.     Read a$(t)
  10. Screen _NewImage(800, 600, 32)
  11. Color _RGB32(255, 255, 255)
  12. start:
  13. score = 0
  14. speed = .5
  15. lives = 5
  16. score$ = Str$(score)
  17. lives$ = Str$(lives)
  18. s$ = "Score: " + score$ + " Lives: " + lives$
  19.  
  20.     x = Rnd * 750
  21.     y = 5
  22.     tt = Int(Rnd * 500) + 1
  23.     word$ = a$(tt)
  24.     c = 1
  25.     Do
  26.         y = y + 10
  27.         If y > 500 Then
  28.             Sound 250, 1
  29.             Sound 150, 1
  30.             lives = lives - 1
  31.             score$ = Str$(score)
  32.             lives$ = Str$(lives)
  33.             s$ = "Score: " + score$ + " Lives: " + lives$
  34.             _Title s$
  35.             If lives = 0 Then
  36.                 Print "    Y o u  L o s e !"
  37.                 Print: Print
  38.                 Input "Again (Y/N)"; ag$
  39.                 If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  40.                 End
  41.             End If
  42.             GoTo more:
  43.         End If
  44.         _PrintString (x, y), word$
  45.         Locate 25, 1
  46.         Print "->";
  47.         w$ = InKey$
  48.         If w$ = Chr$(27) Then End
  49.         Locate 25, 3 + c: Print w$
  50.         If w$ <> "" Then
  51.             If w$ = Mid$(word$, c, 1) Then
  52.                 c = c + 1
  53.                 If c > 4 Then
  54.                     Sound 850, .5
  55.                     speed = speed - .0125
  56.                     score = score + 1
  57.                     score$ = Str$(score)
  58.                     lives$ = Str$(lives)
  59.                     s$ = "Score: " + score$ + " Lives: " + lives$
  60.                     _Title s$
  61.                     If score = 40 Then
  62.                         Print "    Y O U   W I N ! ! ! ! ! ! !"
  63.                         Print: Print
  64.                         Input "Again (Y/N)"; ag$
  65.                         If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  66.                         End
  67.                     End If
  68.                     _Display
  69.                     Cls
  70.                     GoTo more:
  71.                 End If
  72.             Else
  73.                 c = 1
  74.             End If
  75.         End If
  76.         _Delay speed
  77.         _Display
  78.         Cls
  79.     Loop
  80.     more:
  81.  
  82. Data able,acid,aged,also,area,army,away,baby,back,ball
  83. Data band,bank,base,bath,bear,beat,been,beer,bell,belt
  84. Data best,bill,bird,blow,blue,boat,body,bomb,bond,bone
  85. Data book,boom,born,boss,both,bowl,bulk,burn,bush,busy
  86. Data call,calm,came,camp,card,care,case,cash,cast,cell
  87. Data chat,chip,city,club,coal,coat,code,cold,come,cook
  88. Data cool,cope,copy,core,cost,crew,crop,dark,data,date
  89. Data dawn,days,dead,deal,dean,dear,debt,deep,deny,desk
  90. Data dial,dock,diet,disc,disk,does,done,door,dose,down
  91. Data draw,drew,drop,drug,dual,duke,dust,duty,each,earn
  92. Data ease,east,easy,edge,else,even,ever,evil,exit,face
  93. Data fact,fail,fair,fall,farm,fast,fate,fear,feed,feel
  94. Data feet,fell,felt,file,fill,film,find,fine,fire,firm
  95. Data fish,five,flat,flow,food,foot,ford,form,fort,four
  96. Data free,from,fuel,full,fund,gain,game,gate,gave,gear
  97. Data gene,gift,girl,give,glad,goal,goes,gold,Golf,gone
  98. Data good,gray,grew,grey,grow,gulf,hair,half,hall,hand
  99. Data hang,hard,harm,hate,have,head,hear,heat,held,hell
  100. Data help,here,hero,high,hill,hire,hold,hole,holy,home
  101. Data hope,host,hour,huge,hung,hunt,hurt,idea,inch,into
  102. Data iron,item,jack,jane,jean,john,join,jump,jury,just
  103. Data keen,keep,kent,kept,kick,kill,kind,king,knee,knew
  104. Data know,lack,lady,laid,lake,land,lane,last,late,lead
  105. Data left,less,life,lift,like,line,link,list,live,load
  106. Data loan,lock,logo,long,look,lord,lose,loss,lost,love
  107. Data luck,made,mail,main,make,male,many,mark,mass,matt
  108. Data meal,mean,meat,meet,menu,mere,mike,mile,milk,mill
  109. Data mind,mine,miss,mode,mood,moon,more,most,move,much
  110. Data must,name,navy,near,neck,need,news,next,nice,nick
  111. Data nine,none,nose,note,okay,once,only,onto,open,oral
  112. Data over,pace,pack,page,paid,pain,pair,palm,park,part
  113. Data pass,past,path,peak,pick,pink,pipe,plan,play,plot
  114. Data plug,plus,poll,pool,poor,port,post,pull,pure,push
  115. Data race,rail,rain,rank,rare,rate,read,real,rear,rely
  116. Data rent,rest,rice,rich,ride,ring,rise,risk,road,rock
  117. Data role,roll,roof,room,root,rose,rule,rush,ruth,safe
  118. Data said,sake,sale,salt,same,sand,save,seat,seed,seek
  119. Data seem,seen,self,sell,send,sent,sept,ship,shop,shot
  120. Data show,shut,sick,side,sign,site,size,skin,slip,slow
  121. Data snow,soft,soil,sold,sole,some,song,soon,sort,soul
  122. Data spot,star,stay,step,stop,such,suit,sure,take,tale
  123. Data talk,tall,tank,tape,task,team,tech,tell,tend,term
  124. Data test,text,than,that,them,then,they,thin,this,thus
  125. Data till,time,tiny,told,toll,tone,tony,took,tool,tour
  126. Data town,tree,trip,true,tune,turn,twin,type,unit,upon
  127. Data used,user,vary,vast,very,vice,view,vote,wage,wait
  128. Data wake,walk,wall,want,ward,warm,wash,wave,ways,weak
  129. Data wear,week,well,went,were,west,what,when,whom,wide
  130. Data wife,wild,will,wind,wine,wing,wire,wise,wish,with
  131. Data wood,word,wore,work,yard,yeah,year,your,zero,zone
  132.  
« Last Edit: February 06, 2022, 01:23:53 am by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #1 on: February 05, 2022, 09:10:39 pm »
And like most of my apps, I already have an update. I forgot to draw a line for land. When the words hit the land you lose a life.

Code: QB64: [Select]
  1. '4 Letter Word Invaders Game
  2. 'By SierraKen on Feb. 5, 2022
  3. '
  4. 'Test your typing skills by typing each word that falls. No need press the Enter key.
  5. 'The more you get right, the faster it goes. 40 points wins. Good Luck!
  6.  
  7. Dim a$(600)
  8. For t = 1 To 500
  9.     Read a$(t)
  10. Screen _NewImage(800, 600, 32)
  11. Color _RGB32(255, 255, 255)
  12. start:
  13. score = 0
  14. speed = .5
  15. lives = 5
  16. score$ = Str$(score)
  17. lives$ = Str$(lives)
  18. s$ = "Score: " + score$ + " Lives: " + lives$
  19.  
  20.     x = Rnd * 750
  21.     y = 5
  22.     tt = Int(Rnd * 500) + 1
  23.     word$ = a$(tt)
  24.     c = 1
  25.     Do
  26.         Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  27.         y = y + 10
  28.         If y > 500 Then
  29.             Sound 250, 1
  30.             Sound 150, 1
  31.             lives = lives - 1
  32.             score$ = Str$(score)
  33.             lives$ = Str$(lives)
  34.             s$ = "Score: " + score$ + " Lives: " + lives$
  35.             _Title s$
  36.             If lives = 0 Then
  37.                 Print "    Y o u  L o s e !"
  38.                 Print: Print
  39.                 Input "Again (Y/N)"; ag$
  40.                 If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  41.                 End
  42.             End If
  43.             GoTo more:
  44.         End If
  45.         _PrintString (x, y), word$
  46.         Locate 25, 1
  47.         Print "->";
  48.         w$ = InKey$
  49.         If w$ = Chr$(27) Then End
  50.         Locate 25, 3 + c: Print w$
  51.         If w$ <> "" Then
  52.             If w$ = Mid$(word$, c, 1) Then
  53.                 c = c + 1
  54.                 If c > 4 Then
  55.                     Sound 850, .5
  56.                     speed = speed - .0125
  57.                     score = score + 1
  58.                     score$ = Str$(score)
  59.                     lives$ = Str$(lives)
  60.                     s$ = "Score: " + score$ + " Lives: " + lives$
  61.                     _Title s$
  62.                     If score = 40 Then
  63.                         Print "    Y O U   W I N ! ! ! ! ! ! !"
  64.                         Print: Print
  65.                         Input "Again (Y/N)"; ag$
  66.                         If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  67.                         End
  68.                     End If
  69.                     _Display
  70.                     Cls
  71.                     GoTo more:
  72.                 End If
  73.             Else
  74.                 c = 1
  75.             End If
  76.         End If
  77.         _Delay speed
  78.         _Display
  79.         Cls
  80.     Loop
  81.     more:
  82.  
  83. Data able,acid,aged,also,area,army,away,baby,back,ball
  84. Data band,bank,base,bath,bear,beat,been,beer,bell,belt
  85. Data best,bill,bird,blow,blue,boat,body,bomb,bond,bone
  86. Data book,boom,born,boss,both,bowl,bulk,burn,bush,busy
  87. Data call,calm,came,camp,card,care,case,cash,cast,cell
  88. Data chat,chip,city,club,coal,coat,code,cold,come,cook
  89. Data cool,cope,copy,core,cost,crew,crop,dark,data,date
  90. Data dawn,days,dead,deal,dean,dear,debt,deep,deny,desk
  91. Data dial,dock,diet,disc,disk,does,done,door,dose,down
  92. Data draw,drew,drop,drug,dual,duke,dust,duty,each,earn
  93. Data ease,east,easy,edge,else,even,ever,evil,exit,face
  94. Data fact,fail,fair,fall,farm,fast,fate,fear,feed,feel
  95. Data feet,fell,felt,file,fill,film,find,fine,fire,firm
  96. Data fish,five,flat,flow,food,foot,ford,form,fort,four
  97. Data free,from,fuel,full,fund,gain,game,gate,gave,gear
  98. Data gene,gift,girl,give,glad,goal,goes,gold,Golf,gone
  99. Data good,gray,grew,grey,grow,gulf,hair,half,hall,hand
  100. Data hang,hard,harm,hate,have,head,hear,heat,held,hell
  101. Data help,here,hero,high,hill,hire,hold,hole,holy,home
  102. Data hope,host,hour,huge,hung,hunt,hurt,idea,inch,into
  103. Data iron,item,jack,jane,jean,john,join,jump,jury,just
  104. Data keen,keep,kent,kept,kick,kill,kind,king,knee,knew
  105. Data know,lack,lady,laid,lake,land,lane,last,late,lead
  106. Data left,less,life,lift,like,line,link,list,live,load
  107. Data loan,lock,logo,long,look,lord,lose,loss,lost,love
  108. Data luck,made,mail,main,make,male,many,mark,mass,matt
  109. Data meal,mean,meat,meet,menu,mere,mike,mile,milk,mill
  110. Data mind,mine,miss,mode,mood,moon,more,most,move,much
  111. Data must,name,navy,near,neck,need,news,next,nice,nick
  112. Data nine,none,nose,note,okay,once,only,onto,open,oral
  113. Data over,pace,pack,page,paid,pain,pair,palm,park,part
  114. Data pass,past,path,peak,pick,pink,pipe,plan,play,plot
  115. Data plug,plus,poll,pool,poor,port,post,pull,pure,push
  116. Data race,rail,rain,rank,rare,rate,read,real,rear,rely
  117. Data rent,rest,rice,rich,ride,ring,rise,risk,road,rock
  118. Data role,roll,roof,room,root,rose,rule,rush,ruth,safe
  119. Data said,sake,sale,salt,same,sand,save,seat,seed,seek
  120. Data seem,seen,self,sell,send,sent,sept,ship,shop,shot
  121. Data show,shut,sick,side,sign,site,size,skin,slip,slow
  122. Data snow,soft,soil,sold,sole,some,song,soon,sort,soul
  123. Data spot,star,stay,step,stop,such,suit,sure,take,tale
  124. Data talk,tall,tank,tape,task,team,tech,tell,tend,term
  125. Data test,text,than,that,them,then,they,thin,this,thus
  126. Data till,time,tiny,told,toll,tone,tony,took,tool,tour
  127. Data town,tree,trip,true,tune,turn,twin,type,unit,upon
  128. Data used,user,vary,vast,very,vice,view,vote,wage,wait
  129. Data wake,walk,wall,want,ward,warm,wash,wave,ways,weak
  130. Data wear,week,well,went,were,west,what,when,whom,wide
  131. Data wife,wild,will,wind,wine,wing,wire,wise,wish,with
  132. Data wood,word,wore,work,yard,yeah,year,your,zero,zone
  133.  
« Last Edit: February 06, 2022, 01:24:42 am by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #2 on: February 05, 2022, 11:14:28 pm »
I added some fading sky and ground colors. Here is a picture and the update:

Code: QB64: [Select]
  1. '4 Letter Word Invaders Game
  2. 'By SierraKen on Feb. 5, 2022
  3. '
  4. 'Test your typing skills by typing each word that falls. No need press the Enter key.
  5. 'The more you get right, the faster it goes. 40 points wins. Good Luck!
  6.  
  7. Dim a$(600)
  8. For t = 1 To 500
  9.     Read a$(t)
  10. Screen _NewImage(800, 600, 32)
  11. Color _RGB32(255, 255, 255)
  12. start:
  13. score = 0
  14. speed = .5
  15. lives = 5
  16. score$ = Str$(score)
  17. lives$ = Str$(lives)
  18. s$ = "Score: " + score$ + " Lives: " + lives$
  19.  
  20.     x = Rnd * 750
  21.     y = 5
  22.     tt = Int(Rnd * 500) + 1
  23.     word$ = a$(tt)
  24.     c = 1
  25.     Do
  26.         Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  27.         For skyy = 0 To 500
  28.             col = Int(skyy / 2)
  29.             Line (0, skyy)-(800, skyy), _RGB32(0, 0, col)
  30.         Next skyy
  31.         For groundy = 502 To 600
  32.             g = g + 2
  33.             colg = Int(g / 2)
  34.             Line (0, groundy)-(800, groundy), _RGB32(0, colg, 0)
  35.         Next groundy
  36.         g = 0
  37.         y = y + 10
  38.         If y > 500 Then
  39.             Sound 250, 1
  40.             Sound 150, 1
  41.             lives = lives - 1
  42.             score$ = Str$(score)
  43.             lives$ = Str$(lives)
  44.             s$ = "Score: " + score$ + " Lives: " + lives$
  45.             _Title s$
  46.             If lives = 0 Then
  47.                 Print "    Y o u  L o s e !"
  48.                 Print: Print
  49.                 Input "Again (Y/N)"; ag$
  50.                 If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  51.                 End
  52.             End If
  53.             GoTo more:
  54.         End If
  55.         _PrintString (x, y), word$
  56.         Locate 25, 1
  57.         Print "->";
  58.         w$ = InKey$
  59.         If w$ = Chr$(27) Then End
  60.         Locate 25, 3 + c: Print w$
  61.         If w$ <> "" Then
  62.             If w$ = Mid$(word$, c, 1) Then
  63.                 c = c + 1
  64.                 If c > 4 Then
  65.                     Sound 850, .5
  66.                     speed = speed - .0125
  67.                     score = score + 1
  68.                     score$ = Str$(score)
  69.                     lives$ = Str$(lives)
  70.                     s$ = "Score: " + score$ + " Lives: " + lives$
  71.                     _Title s$
  72.                     If score = 40 Then
  73.                         Print "    Y O U   W I N ! ! ! ! ! ! !"
  74.                         Print: Print
  75.                         Input "Again (Y/N)"; ag$
  76.                         If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  77.                         End
  78.                     End If
  79.                     _Display
  80.                     Cls
  81.                     GoTo more:
  82.                 End If
  83.             Else
  84.                 c = 1
  85.             End If
  86.         End If
  87.         _Delay speed
  88.         _Display
  89.         Cls
  90.     Loop
  91.     more:
  92.  
  93. Data able,acid,aged,also,area,army,away,baby,back,ball
  94. Data band,bank,base,bath,bear,beat,been,beer,bell,belt
  95. Data best,bill,bird,blow,blue,boat,body,bomb,bond,bone
  96. Data book,boom,born,boss,both,bowl,bulk,burn,bush,busy
  97. Data call,calm,came,camp,card,care,case,cash,cast,cell
  98. Data chat,chip,city,club,coal,coat,code,cold,come,cook
  99. Data cool,cope,copy,core,cost,crew,crop,dark,data,date
  100. Data dawn,days,dead,deal,dean,dear,debt,deep,deny,desk
  101. Data dial,dock,diet,disc,disk,does,done,door,dose,down
  102. Data draw,drew,drop,drug,dual,duke,dust,duty,each,earn
  103. Data ease,east,easy,edge,else,even,ever,evil,exit,face
  104. Data fact,fail,fair,fall,farm,fast,fate,fear,feed,feel
  105. Data feet,fell,felt,file,fill,film,find,fine,fire,firm
  106. Data fish,five,flat,flow,food,foot,ford,form,fort,four
  107. Data free,from,fuel,full,fund,gain,game,gate,gave,gear
  108. Data gene,gift,girl,give,glad,goal,goes,gold,Golf,gone
  109. Data good,gray,grew,grey,grow,gulf,hair,half,hall,hand
  110. Data hang,hard,harm,hate,have,head,hear,heat,held,hell
  111. Data help,here,hero,high,hill,hire,hold,hole,holy,home
  112. Data hope,host,hour,huge,hung,hunt,hurt,idea,inch,into
  113. Data iron,item,jack,jane,jean,john,join,jump,jury,just
  114. Data keen,keep,kent,kept,kick,kill,kind,king,knee,knew
  115. Data know,lack,lady,laid,lake,land,lane,last,late,lead
  116. Data left,less,life,lift,like,line,link,list,live,load
  117. Data loan,lock,logo,long,look,lord,lose,loss,lost,love
  118. Data luck,made,mail,main,make,male,many,mark,mass,matt
  119. Data meal,mean,meat,meet,menu,mere,mike,mile,milk,mill
  120. Data mind,mine,miss,mode,mood,moon,more,most,move,much
  121. Data must,name,navy,near,neck,need,news,next,nice,nick
  122. Data nine,none,nose,note,okay,once,only,onto,open,oral
  123. Data over,pace,pack,page,paid,pain,pair,palm,park,part
  124. Data pass,past,path,peak,pick,pink,pipe,plan,play,plot
  125. Data plug,plus,poll,pool,poor,port,post,pull,pure,push
  126. Data race,rail,rain,rank,rare,rate,read,real,rear,rely
  127. Data rent,rest,rice,rich,ride,ring,rise,risk,road,rock
  128. Data role,roll,roof,room,root,rose,rule,rush,ruth,safe
  129. Data said,sake,sale,salt,same,sand,save,seat,seed,seek
  130. Data seem,seen,self,sell,send,sent,sept,ship,shop,shot
  131. Data show,shut,sick,side,sign,site,size,skin,slip,slow
  132. Data snow,soft,soil,sold,sole,some,song,soon,sort,soul
  133. Data spot,star,stay,step,stop,such,suit,sure,take,tale
  134. Data talk,tall,tank,tape,task,team,tech,tell,tend,term
  135. Data test,text,than,that,them,then,they,thin,this,thus
  136. Data till,time,tiny,told,toll,tone,tony,took,tool,tour
  137. Data town,tree,trip,true,tune,turn,twin,type,unit,upon
  138. Data used,user,vary,vast,very,vice,view,vote,wage,wait
  139. Data wake,walk,wall,want,ward,warm,wash,wave,ways,weak
  140. Data wear,week,well,went,were,west,what,when,whom,wide
  141. Data wife,wild,will,wind,wine,wing,wire,wise,wish,with
  142. Data wood,word,wore,work,yard,yeah,year,your,zero,zone
  143.  
4 Letter Word Invaders by SierraKen.jpg
* 4 Letter Word Invaders by SierraKen.jpg (Filesize: 35.74 KB, Dimensions: 802x624, Views: 127)
« Last Edit: February 06, 2022, 01:25:51 am by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #3 on: February 05, 2022, 11:55:08 pm »
I decided to make it winnable, for me at least. So I can just barely win it now with 40 points. I also changed a couple words in the DATA lines. And I added some LOCATE commands to the ending text and changed "You Lose" to "GAME OVER".

Code: QB64: [Select]
  1. '4 Letter Word Invaders Game
  2. 'By SierraKen on Feb. 5, 2022
  3. '
  4. 'Test your typing skills by typing each word that falls. No need press the Enter key.
  5. 'The more you get right, the faster it goes. 40 points wins. Good Luck!
  6.  
  7. Dim a$(600)
  8. For t = 1 To 500
  9.     Read a$(t)
  10. Screen _NewImage(800, 600, 32)
  11. Color _RGB32(255, 255, 255)
  12. start:
  13. score = 0
  14. speed = .5
  15. lives = 5
  16. score$ = Str$(score)
  17. lives$ = Str$(lives)
  18. s$ = "Score: " + score$ + " Lives: " + lives$
  19.  
  20.     x = Rnd * 750
  21.     y = 5
  22.     tt = Int(Rnd * 500) + 1
  23.     word$ = a$(tt)
  24.     c = 1
  25.     Do
  26.         Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  27.         For skyy = 0 To 500
  28.             col = Int(skyy / 2)
  29.             Line (0, skyy)-(800, skyy), _RGB32(0, 0, col)
  30.         Next skyy
  31.         For groundy = 502 To 600
  32.             g = g + 2
  33.             colg = Int(g / 2)
  34.             Line (0, groundy)-(800, groundy), _RGB32(0, colg, 0)
  35.         Next groundy
  36.         g = 0
  37.         y = y + 10
  38.         If y > 500 Then
  39.             Sound 250, 1
  40.             Sound 150, 1
  41.             lives = lives - 1
  42.             score$ = Str$(score)
  43.             lives$ = Str$(lives)
  44.             s$ = "Score: " + score$ + " Lives: " + lives$
  45.             _Title s$
  46.             If lives = 0 Then
  47.                 Locate 15, 15
  48.                 Print "G A M E   O V E R"
  49.                 Locate 17, 15
  50.                 Input "Again (Y/N)"; ag$
  51.                 If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  52.                 End
  53.             End If
  54.             GoTo more:
  55.         End If
  56.         _PrintString (x, y), word$
  57.         Locate 25, 1
  58.         Print "->";
  59.         w$ = InKey$
  60.         If w$ = Chr$(27) Then End
  61.         Locate 25, 3 + c: Print w$
  62.         If w$ <> "" Then
  63.             If w$ = Mid$(word$, c, 1) Then
  64.                 c = c + 1
  65.                 If c > 4 Then
  66.                     Sound 850, .5
  67.                     speed = speed - .012375
  68.                     score = score + 1
  69.                     score$ = Str$(score)
  70.                     lives$ = Str$(lives)
  71.                     s$ = "Score: " + score$ + " Lives: " + lives$
  72.                     _Title s$
  73.                     If score = 40 Then
  74.                         Locate 15, 15
  75.                         Print "Y O U   W I N ! ! ! ! ! ! ! ! ! !"
  76.                         Locate 17, 15
  77.                         Input "Again (Y/N)"; ag$
  78.                         If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  79.                         End
  80.                     End If
  81.                     _Display
  82.                     Cls
  83.                     GoTo more:
  84.                 End If
  85.             Else
  86.                 c = 1
  87.             End If
  88.         End If
  89.         _Delay speed
  90.         _Display
  91.         Cls
  92.     Loop
  93.     more:
  94.  
  95. Data able,acid,aged,also,area,army,away,baby,back,ball
  96. Data band,bank,base,bath,bear,beat,been,beer,bell,belt
  97. Data best,bill,bird,blow,blue,boat,body,bomb,bond,bone
  98. Data book,boom,born,boss,both,bowl,bulk,burn,bush,busy
  99. Data call,calm,came,camp,card,care,case,cash,cast,cell
  100. Data chat,chip,city,club,coal,coat,code,cold,come,cook
  101. Data cool,cope,copy,core,cost,crew,crop,dark,data,date
  102. Data dawn,days,dead,deal,dean,dear,debt,deep,deny,desk
  103. Data dial,diet,disc,disk,dock,does,done,door,dose,down
  104. Data draw,drew,drop,drug,dual,duke,dust,duty,each,earn
  105. Data ease,east,easy,edge,else,even,ever,evil,exit,face
  106. Data fact,fail,fair,fall,farm,fast,fate,fear,feed,feel
  107. Data feet,fell,felt,file,fill,film,find,fine,fire,firm
  108. Data fish,five,flat,flow,food,foot,ford,form,fort,four
  109. Data free,from,fuel,full,fund,gain,game,gate,gave,gear
  110. Data gene,gift,girl,give,glad,goal,goes,gold,Golf,gone
  111. Data good,gray,grew,grey,grow,gulf,hair,half,hall,hand
  112. Data hang,hard,harm,hate,have,head,hear,heat,held,hell
  113. Data help,here,hero,high,hill,hire,hold,hole,holy,home
  114. Data hope,host,hour,huge,hung,hunt,hurt,idea,inch,into
  115. Data iron,item,jack,jane,jean,john,join,jump,jury,just
  116. Data keen,keep,kent,kept,kick,kill,kind,king,knee,knew
  117. Data know,lack,lady,laid,lake,land,lane,last,late,lead
  118. Data left,less,life,lift,like,line,link,list,live,load
  119. Data loan,lock,logo,long,look,lord,lose,loss,lost,love
  120. Data luck,made,mail,main,make,male,many,mark,mass,matt
  121. Data meal,mean,meat,meet,menu,mere,mike,mile,milk,mill
  122. Data mind,mine,miss,mode,mood,moon,more,most,move,much
  123. Data must,name,navy,near,neck,need,news,next,nice,nick
  124. Data nine,none,nose,note,okay,once,only,onto,open,oral
  125. Data over,pace,pack,page,paid,pain,pair,palm,park,part
  126. Data pass,past,path,peak,pick,pink,pipe,plan,play,plot
  127. Data plug,plus,poll,pool,poor,port,post,pull,pure,push
  128. Data race,rail,rain,rank,rare,rate,read,real,rear,rely
  129. Data rent,rest,rice,rich,ride,ring,rise,risk,road,rock
  130. Data role,roll,roof,room,root,rose,rule,rush,ruth,safe
  131. Data said,sake,sale,salt,same,sand,save,seat,seed,seek
  132. Data seem,seen,self,sell,send,sent,sept,ship,shop,shot
  133. Data show,shut,sick,side,sign,site,size,skin,slip,slow
  134. Data snow,soft,soil,sold,sole,some,song,soon,sort,soul
  135. Data spot,star,stay,step,stop,such,suit,sure,take,tale
  136. Data talk,tall,tank,tape,task,team,tech,tell,tend,term
  137. Data test,text,than,that,them,then,they,thin,this,thus
  138. Data till,time,tiny,told,toll,tone,tony,took,tool,tour
  139. Data town,tree,trip,true,tune,turn,twin,type,unit,upon
  140. Data used,user,vary,vast,very,vice,view,vote,wage,wait
  141. Data wake,walk,wall,want,ward,warm,wash,wave,ways,weak
  142. Data wear,week,well,went,were,west,what,when,whom,wide
  143. Data wife,wild,will,wind,wine,wing,wire,wise,wish,with
  144. Data wood,word,wore,work,yard,yeah,year,your,zero,zone
  145.  

Marked as best answer by SierraKen on February 06, 2022, 06:53:49 am

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #4 on: February 06, 2022, 11:53:07 am »
Sorry for so many updates. I decided to make a welcome screen and I changed it to 45 points wins the game. After 38 points it doesn't get any faster. I should also mention that in the beginning it might seem very slow when you type, but since I use a _delay for the speed of the game, the whole game moves faster and faster as you go from word to word. I also changed the position of the GAME OVER and YOU WIN! words to the center of the screen more.

Code: QB64: [Select]
  1. '4 Letter Word Invaders Game
  2. 'By SierraKen on Feb. 6, 2022
  3. '
  4. 'Test your typing skills by typing each word that falls. No need press the Enter key.
  5. 'The more you get right, the faster it goes. 40 points wins. Good Luck!
  6.  
  7. Dim a$(600)
  8. _Title "4 Letter Word Invasion"
  9. For t = 1 To 500
  10.     Read a$(t)
  11. Screen _NewImage(800, 600, 32)
  12. Color _RGB32(255, 255, 255)
  13. start:
  14. Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  15. For skyy = 0 To 500
  16.     col = Int(skyy / 2)
  17.     Line (0, skyy)-(800, skyy), _RGB32(0, 0, col)
  18. Next skyy
  19. For groundy = 502 To 600
  20.     g = g + 2
  21.     colg = Int(g / 2)
  22.     Line (0, groundy)-(800, groundy), _RGB32(0, colg, 0)
  23. Next groundy
  24. g = 0
  25. Locate 15, 40
  26. Print "4 Letter Word Invasion!"
  27. Locate 17, 40
  28. Print "By SierraKen"
  29. Locate 19, 40
  30. Print "Type the words that fall down"
  31. Locate 20, 40
  32. Print "Before they reach the ground!"
  33. Locate 21, 40
  34. Print "45 points wins the game."
  35. Locate 22, 40
  36. Print "Start out with 5 lives."
  37. Locate 23, 40
  38. Print "Good luck!"
  39. Locate 25, 40
  40. Input "Press Enter To Start.", en$
  41. score = 0
  42. speed = .5
  43. lives = 5
  44. score$ = Str$(score)
  45. lives$ = Str$(lives)
  46. s$ = "Score: " + score$ + " Lives: " + lives$
  47.  
  48.     x = Rnd * 750
  49.     y = 5
  50.     tt = Int(Rnd * 500) + 1
  51.     word$ = a$(tt)
  52.     c = 1
  53.     Do
  54.         Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  55.         For skyy = 0 To 500
  56.             col = Int(skyy / 2)
  57.             Line (0, skyy)-(800, skyy), _RGB32(0, 0, col)
  58.         Next skyy
  59.         For groundy = 502 To 600
  60.             g = g + 2
  61.             colg = Int(g / 2)
  62.             Line (0, groundy)-(800, groundy), _RGB32(0, colg, 0)
  63.         Next groundy
  64.         g = 0
  65.         y = y + 10
  66.         If y > 500 Then
  67.             Sound 250, 1
  68.             Sound 150, 1
  69.             lives = lives - 1
  70.             score$ = Str$(score)
  71.             lives$ = Str$(lives)
  72.             s$ = "Score: " + score$ + " Lives: " + lives$
  73.             _Title s$
  74.             If lives = 0 Then
  75.                 Locate 15, 40
  76.                 Print "G A M E   O V E R"
  77.                 Locate 17, 40
  78.                 Input "Again (Y/N)"; ag$
  79.                 If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  80.                 End
  81.             End If
  82.             GoTo more:
  83.         End If
  84.         _PrintString (x, y), word$
  85.         Locate 25, 1
  86.         Print "->";
  87.         w$ = InKey$
  88.         If w$ = Chr$(27) Then End
  89.         Locate 25, 3 + c: Print w$
  90.         If w$ <> "" Then
  91.             If w$ = Mid$(word$, c, 1) Then
  92.                 c = c + 1
  93.                 If c > 4 Then
  94.                     Sound 850, .5
  95.                     If score < 39 Then speed = speed - .012375
  96.                     score = score + 1
  97.                     score$ = Str$(score)
  98.                     lives$ = Str$(lives)
  99.                     s$ = "Score: " + score$ + " Lives: " + lives$
  100.                     _Title s$
  101.                     If score = 45 Then
  102.                         Locate 15, 40
  103.                         Print "Y O U   W I N ! ! ! ! ! ! ! ! ! !"
  104.                         Locate 17, 40
  105.                         Input "Again (Y/N)"; ag$
  106.                         If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  107.                         End
  108.                     End If
  109.                     _Display
  110.                     Cls
  111.                     GoTo more:
  112.                 End If
  113.             Else
  114.                 c = 1
  115.             End If
  116.         End If
  117.         _Delay speed
  118.         _Display
  119.         Cls
  120.     Loop
  121.     more:
  122.  
  123. Data able,acid,aged,also,area,army,away,baby,back,ball
  124. Data band,bank,base,bath,bear,beat,been,beer,bell,belt
  125. Data best,bill,bird,blow,blue,boat,body,bomb,bond,bone
  126. Data book,boom,born,boss,both,bowl,bulk,burn,bush,busy
  127. Data call,calm,came,camp,card,care,case,cash,cast,cell
  128. Data chat,chip,city,club,coal,coat,code,cold,come,cook
  129. Data cool,cope,copy,core,cost,crew,crop,dark,data,date
  130. Data dawn,days,dead,deal,dean,dear,debt,deep,deny,desk
  131. Data dial,diet,disc,disk,dock,does,done,door,dose,down
  132. Data draw,drew,drop,drug,dual,duke,dust,duty,each,earn
  133. Data ease,east,easy,edge,else,even,ever,evil,exit,face
  134. Data fact,fail,fair,fall,farm,fast,fate,fear,feed,feel
  135. Data feet,fell,felt,file,fill,film,find,fine,fire,firm
  136. Data fish,five,flat,flow,food,foot,ford,form,fort,four
  137. Data free,from,fuel,full,fund,gain,game,gate,gave,gear
  138. Data gene,gift,girl,give,glad,goal,goes,gold,Golf,gone
  139. Data good,gray,grew,grey,grow,gulf,hair,half,hall,hand
  140. Data hang,hard,harm,hate,have,head,hear,heat,held,hell
  141. Data help,here,hero,high,hill,hire,hold,hole,holy,home
  142. Data hope,host,hour,huge,hung,hunt,hurt,idea,inch,into
  143. Data iron,item,jack,jane,jean,john,join,jump,jury,just
  144. Data keen,keep,kent,kept,kick,kill,kind,king,knee,knew
  145. Data know,lack,lady,laid,lake,land,lane,last,late,lead
  146. Data left,less,life,lift,like,line,link,list,live,load
  147. Data loan,lock,logo,long,look,lord,lose,loss,lost,love
  148. Data luck,made,mail,main,make,male,many,mark,mass,matt
  149. Data meal,mean,meat,meet,menu,mere,mike,mile,milk,mill
  150. Data mind,mine,miss,mode,mood,moon,more,most,move,much
  151. Data must,name,navy,near,neck,need,news,next,nice,nick
  152. Data nine,none,nose,note,okay,once,only,onto,open,oral
  153. Data over,pace,pack,page,paid,pain,pair,palm,park,part
  154. Data pass,past,path,peak,pick,pink,pipe,plan,play,plot
  155. Data plug,plus,poll,pool,poor,port,post,pull,pure,push
  156. Data race,rail,rain,rank,rare,rate,read,real,rear,rely
  157. Data rent,rest,rice,rich,ride,ring,rise,risk,road,rock
  158. Data role,roll,roof,room,root,rose,rule,rush,ruth,safe
  159. Data said,sake,sale,salt,same,sand,save,seat,seed,seek
  160. Data seem,seen,self,sell,send,sent,sept,ship,shop,shot
  161. Data show,shut,sick,side,sign,site,size,skin,slip,slow
  162. Data snow,soft,soil,sold,sole,some,song,soon,sort,soul
  163. Data spot,star,stay,step,stop,such,suit,sure,take,tale
  164. Data talk,tall,tank,tape,task,team,tech,tell,tend,term
  165. Data test,text,than,that,them,then,they,thin,this,thus
  166. Data till,time,tiny,told,toll,tone,tony,took,tool,tour
  167. Data town,tree,trip,true,tune,turn,twin,type,unit,upon
  168. Data used,user,vary,vast,very,vice,view,vote,wage,wait
  169. Data wake,walk,wall,want,ward,warm,wash,wave,ways,weak
  170. Data wear,week,well,went,were,west,what,when,whom,wide
  171. Data wife,wild,will,wind,wine,wing,wire,wise,wish,with
  172. Data wood,word,wore,work,yard,yeah,year,your,zero,zone
  173.  
4 Letter Word Invaders by SierraKen.jpg
* 4 Letter Word Invaders by SierraKen.jpg (Filesize: 35.74 KB, Dimensions: 802x624, Views: 125)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #5 on: February 06, 2022, 10:28:46 pm »
Does anybody like this game? Has anybody played it?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #6 on: February 07, 2022, 12:48:04 pm »
Plays OK, slow too much, fast too much (can't read word as it blurs or doubles going down screen). Frankly I'd rather do something else.

Player probably has to set a time level challenging for them self. How about multi-letter with a little more time for extra letters?

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #7 on: February 07, 2022, 12:53:35 pm »
Thanks B+, I wondered about that too. Maybe it's my giant monitor that lets me see the words, but just barely. I'll try to make something like you say, falling letters instead of words and have it like it's raining letters, but not too many. I can increase the letters instead of the speed. :) Or some of both. Thanks for the idea.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #8 on: February 07, 2022, 10:47:18 pm »
B+, or anyone else, here is "Letter Invasion", which has falling letters where you press on the keyboard to go away. There is a problem with it though that I can't seem to fix. Sometimes when you press one of the letters, a few of the letters falling disappear. I've tried for many hours to try to fix it without success. It probably has to do with counting the "l" variable for each letter. I'm not sure how to remove just one inside an array and keep the others going. It usually works fine though but for some reason sometimes it doesn't. Can anyone show me what I can add or change? Thanks. Remember, I don't have hardly any experience with double arrays so I would rather just use single arrays if it's possible. This is a different game than the one above on this forum thread. But since B+ brought this idea up here, I decided to post here.

Code: QB64: [Select]
  1. Dim a$(100)
  2. Dim x(100), y(100), letter$(100)
  3. _Title "Letters Invasion"
  4. Screen _NewImage(800, 600, 32)
  5. Color _RGB32(255, 255, 255)
  6. For t = 65 To 90
  7.     r = r + 1
  8.     a$(r) = Chr$(t)
  9.  
  10. start:
  11.  
  12. Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  13. For skyy = 0 To 500
  14.     col = Int(skyy / 2)
  15.     Line (0, skyy)-(800, skyy), _RGB32(0, 0, col)
  16. Next skyy
  17. For groundy = 502 To 600
  18.     g = g + 2
  19.     colg = Int(g / 2)
  20.     Line (0, groundy)-(800, groundy), _RGB32(0, colg, 0)
  21. Next groundy
  22. g = 0
  23. Locate 15, 40
  24. Print "Letter Invasion!"
  25. Locate 17, 40
  26. Print "By SierraKen"
  27. Locate 19, 40
  28. Print "Type the letters that fall down"
  29. Locate 20, 40
  30. Print "Before they reach the ground!"
  31. Locate 21, 40
  32. Print "450 points wins the game."
  33. Locate 23, 40
  34. Color _RGB32(255, 0, 0)
  35. Print "TURN ON CAPS LOCK"
  36. Color _RGB32(255, 255, 255)
  37. Locate 26, 40
  38. Print "Good luck!"
  39. Locate 27, 40
  40. Input "Press Enter To Start.", en$
  41. l = 0: ll = 0
  42. tt = 0
  43. score = 0
  44. speed = .1
  45. lives = 5
  46. score$ = Str$(score)
  47. lives$ = Str$(lives)
  48. s$ = "Score: " + score$ + " Lives: " + lives$
  49. amount = 10
  50. timing = 15
  51.  
  52. GoSub makingletters:
  53.     _Limit 25
  54.     Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  55.     For skyy = 0 To 500
  56.         col = Int(skyy / 2)
  57.         Line (0, skyy)-(800, skyy), _RGB32(0, 0, col)
  58.     Next skyy
  59.     For groundy = 502 To 600
  60.         g = g + 2
  61.         colg = Int(g / 2)
  62.         Line (0, groundy)-(800, groundy), _RGB32(0, colg, 0)
  63.     Next groundy
  64.     g = 0
  65.     For rl = 1 To l
  66.         If letter$(rl) <> "" Then _PrintString (x(rl), y(rl)), letter$(rl)
  67.     Next rl
  68.  
  69.     Locate 25, 1
  70.     Print "->";
  71.     w$ = InKey$
  72.     If w$ = Chr$(27) Then End
  73.     Locate 25, 3: Print w$
  74.  
  75.     ll = ll + 1
  76.     If ll > timing Then GoSub makingletters:
  77.     For yy = 1 To l
  78.         If letter$(yy) <> "" Then y(yy) = y(yy) + 10
  79.     Next yy
  80.  
  81.     For yyy = 1 To l
  82.         If y(yyy) > 500 Then
  83.             Sound 250, 1
  84.             Sound 150, 1
  85.             lives = lives - 1
  86.             score$ = Str$(score)
  87.             lives$ = Str$(lives)
  88.             s$ = "Score: " + score$ + " Lives: " + lives$
  89.             _Title s$
  90.             If lives = 0 Then
  91.                 Locate 15, 40
  92.                 Print "G A M E   O V E R"
  93.                 Locate 17, 40
  94.                 Input "Again (Y/N)"; ag$
  95.                 If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  96.                 End
  97.             End If
  98.             GoSub makingletters:
  99.             GoTo skip1:
  100.         End If
  101.     Next yyy
  102.     skip1:
  103.     If w$ <> "" Then
  104.         For check = 1 To l
  105.             If w$ = letter$(check) Then
  106.                 Sound 850, .5
  107.                 If score < 320 Then speed = speed - .001
  108.                 score = score + 10
  109.                 If score / 50 = Int(score / 50) Then amount = amount + 1
  110.                 score$ = Str$(score)
  111.                 lives$ = Str$(lives)
  112.                 s$ = "Score: " + score$ + " Lives: " + lives$
  113.                 _Title s$
  114.                 If score > 450 Then
  115.                     Locate 15, 40
  116.                     Print "Y O U   W I N ! ! ! ! ! ! ! ! ! !"
  117.                     Locate 17, 40
  118.                     Input "Again (Y/N)"; ag$
  119.                     If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  120.                     End
  121.                 End If
  122.                 letter$(check) = ""
  123.                 GoSub makingletters:
  124.                 GoTo skip2:
  125.             End If
  126.         Next check
  127.     End If
  128.     skip2:
  129.  
  130.     _Delay speed
  131.     _Display
  132.     Cls
  133.  
  134. makingletters:
  135. w$ = ""
  136. ll = 0
  137. l = l + 1
  138. If l > amount Then l = 1
  139. x(l) = (Rnd * 750) + 5
  140. y(l) = 5
  141. tt = Int(Rnd * 24) + 1
  142. letter$(l) = a$(tt)
  143.  
  144.  


Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #9 on: February 08, 2022, 03:05:26 am »
Plays OK, slow too much, fast too much (can't read word as it blurs or doubles going down screen). Frankly I'd rather do something else.

That is brutally devastating, bplus.  Perhaps all it needs is a quick mod?

Code: QB64: [Select]
  1. const nn = 1
  2. Const twidth = 800, theight = 600, zoom = 128
  3. Dim Shared noise(nn*twidth * theight) '//the noise array
  4. Dim Shared texture(nn*twidth * theight) '//texture array
  5. Dim Shared pal(256) As _Unsigned Long '//color palette
  6.  
  7. Dim a$(100)
  8. Dim x(100), y(100), letter$(100)
  9. _Title "Letters Invasion B+ mod"
  10. Screen _NewImage(800, 600, 32)
  11.  
  12. MakePalette 255, 155, 255, 10, 100, 180
  13. GenerateNoise
  14. buildtexture
  15.  
  16. vs = _newimage(twidth, theight, 32)
  17. drawtexture 0
  18.  
  19. Color _RGB32(255, 255, 255)
  20. For t = 65 To 90
  21.     r = r + 1
  22.     a$(r) = Chr$(t)
  23.  
  24. start:
  25.  
  26. Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  27. For skyy = 0 To 500
  28.     col = Int(skyy / 2)
  29.     Line (0, skyy)-(800, skyy), _RGB32(0, 0, col)
  30. Next skyy
  31.  
  32. '_putimage (i , 0)-step(800,600), vs
  33.  
  34. For groundy = 502 To 600
  35.     g = g + 2
  36.     colg = Int(g / 2)
  37.     Line (0, groundy)-(800, groundy), _RGB32(0, colg, 0)
  38. Next groundy
  39. g = 0
  40. Locate 15, 40
  41. Print "Letter Invasion!"
  42. Locate 17, 40
  43. Print "By SierraKen"
  44. Locate 19, 40
  45. Print "Type the letters that fall down"
  46. Locate 20, 40
  47. Print "Before they reach the ground!"
  48. Locate 21, 40
  49. Print "450 points wins the game."
  50. Locate 23, 40
  51. Color _RGB32(255, 0, 0)
  52. Print "TURN ON CAPS LOCK"
  53. Color _RGB32(255, 255, 255)
  54. Locate 26, 40
  55. Print "Good luck!"
  56. Locate 27, 40
  57. Input "Press Enter To Start.", en$
  58. l = 0: ll = 0
  59. tt = 0
  60. score = 0
  61. speed = .1
  62. lives = 5
  63. score$ = Str$(score)
  64. lives$ = Str$(lives)
  65. s$ = "Score: " + score$ + " Lives: " + lives$
  66. amount = 10
  67. timing = 15
  68.  
  69. GoSub makingletters:
  70.  
  71. i = 0
  72. j = -1
  73.         i = i + 5
  74.         if i >= 800 then
  75.                 i = 0
  76.                 j = not j
  77.         end if         
  78.  
  79.         if j then
  80.                 _putimage (i , 0)-step(800,600), vs
  81.                 _putimage (i , 0)-step(-800,600), vs
  82.         else
  83.                 _putimage (i + 800, 0)-step(-800,600), vs
  84.                 _putimage (i - 800 , 0)-step(800,600), vs
  85.  
  86.         end if
  87.     '_Limit 25
  88.  
  89.     'Line (0, 501)-(800, 501), _RGB32(255, 255, 255)
  90.     'For skyy = 0 To 500
  91.     '    col = Int(skyy / 2)
  92.     '    Line (0, skyy)-(800, skyy), _RGB32(0, 0, col)
  93.     'Next skyy
  94.  
  95.  
  96.  
  97.     For groundy = 502 To 600
  98.         g = g + 2
  99.         colg = Int(g / 2)
  100.         Line (0, groundy)-(800, groundy), _RGB32(0, colg, 0)
  101.     Next groundy
  102.     g = 0
  103.     For rl = 1 To l
  104.         If letter$(rl) <> "" Then _PrintString (x(rl), y(rl)), letter$(rl)
  105.     Next rl
  106.  
  107.     Locate 25, 1
  108.     Print "->";
  109.     w$ = InKey$
  110.     If w$ = Chr$(27) Then End
  111.     Locate 25, 3: Print w$
  112.  
  113.     ll = ll + 1
  114.     If ll > timing Then GoSub makingletters:
  115.     For yy = 1 To l
  116.         If letter$(yy) <> "" Then y(yy) = y(yy) + 10
  117.     Next yy
  118.  
  119.     For yyy = 1 To l
  120.         If y(yyy) > 500 Then
  121.             Sound 250, 1
  122.             Sound 150, 1
  123.             lives = lives - 1
  124.             score$ = Str$(score)
  125.             lives$ = Str$(lives)
  126.             s$ = "Score: " + score$ + " Lives: " + lives$
  127.             _Title s$
  128.             If lives = 0 Then
  129.                 Locate 15, 40
  130.                 Print "G A M E   O V E R"
  131.                 Locate 17, 40
  132.                 Input "Again (Y/N)"; ag$
  133.                 If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  134.                 End
  135.             End If
  136.             GoSub makingletters:
  137.             GoTo skip1:
  138.         End If
  139.     Next yyy
  140.     skip1:
  141.     If w$ <> "" Then
  142.         For check = 1 To l
  143.             If w$ = letter$(check) Then
  144.                 Sound 850, .5
  145.                 If score < 320 Then speed = speed - .001
  146.                 score = score + 10
  147.                 If score / 50 = Int(score / 50) Then amount = amount + 1
  148.                 score$ = Str$(score)
  149.                 lives$ = Str$(lives)
  150.                 s$ = "Score: " + score$ + " Lives: " + lives$
  151.                 _Title s$
  152.                 If score > 450 Then
  153.                     Locate 15, 40
  154.                     Print "Y O U   W I N ! ! ! ! ! ! ! ! ! !"
  155.                     Locate 17, 40
  156.                     Input "Again (Y/N)"; ag$
  157.                     If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  158.                     End
  159.                 End If
  160.                 letter$(check) = ""
  161.                 GoSub makingletters:
  162.                 GoTo skip2:
  163.             End If
  164.         Next check
  165.     End If
  166.     skip2:
  167.  
  168.         _LIMIT 10
  169.     '_Delay speed
  170.     _Display
  171.     Cls
  172.  
  173. makingletters:
  174. w$ = ""
  175. ll = 0
  176. l = l + 1
  177. If l > amount Then l = 1
  178. x(l) = (Rnd * 750) + 5
  179. y(l) = 5
  180. tt = Int(Rnd * 24) + 1
  181. letter$(l) = a$(tt)
  182.  
  183.  
  184. '//interpolation code by rattrapmax6
  185. Sub MakePalette (sr, sg, sb, er, eg, eb) ' (b+) start and end RGB's ? yes
  186.     Dim i, istart(3), iend(3), ishow(3), rend(3), interpol(3)
  187.  
  188.     interpol(0) = 255
  189.     istart(1) = sr
  190.     istart(2) = sg
  191.     istart(3) = sb
  192.     iend(1) = er
  193.     iend(2) = eg
  194.     iend(3) = eb
  195.     interpol(1) = (istart(1) - iend(1)) / interpol(0)
  196.     interpol(2) = (istart(2) - iend(2)) / interpol(0)
  197.     interpol(3) = (istart(3) - iend(3)) / interpol(0)
  198.     rend(1) = istart(1)
  199.     rend(2) = istart(2)
  200.     rend(3) = istart(3)
  201.  
  202.     For i = 0 To 255
  203.         ishow(1) = rend(1)
  204.         ishow(2) = rend(2)
  205.         ishow(3) = rend(3)
  206.  
  207.         pal(i) = _RGB32(ishow(1), ishow(2), ishow(3))
  208.  
  209.         rend(1) = rend(1) - interpol(1)
  210.         rend(2) = rend(2) - interpol(2)
  211.         rend(3) = rend(3) - interpol(3)
  212.     Next i
  213.  
  214. '//generates random noise.
  215. Sub GenerateNoise ()
  216.     Dim As Long x, y
  217.  
  218.     For x = 0 To nn*twidth - 1
  219.         For y = 0 To theight - 1
  220.                         zz = rnd
  221.             noise(x + y * twidth) = zz
  222.         Next y
  223.     Next x
  224.  
  225.  
  226. Function SmoothNoise (x, y)
  227.     '//get fractional part of x and y
  228.     Dim fractx, fracty, x1, y1, x2, y2, value
  229.     fractx = x - Int(x)
  230.     fracty = y - Int(y)
  231.  
  232.     '//wrap around
  233.     x1 = (Int(x) + nn*twidth) Mod twidth
  234.     y1 = (Int(y) + theight) Mod theight
  235.  
  236.     '//neighbor values
  237.     x2 = (x1 + nn*twidth - 1) Mod twidth
  238.     y2 = (y1 + theight - 1) Mod theight
  239.  
  240.     '//smooth the noise with bilinear interpolation
  241.     value = 0.0
  242.     value = value + fractx * fracty * noise(x1 + y1 * twidth)
  243.     value = value + fractx * (1 - fracty) * noise(x1 + y2 * twidth)
  244.     value = value + (1 - fractx) * fracty * noise(x2 + y1 * twidth)
  245.     value = value + (1 - fractx) * (1 - fracty) * noise(x2 + y2 * twidth)
  246.  
  247.     SmoothNoise = value
  248.  
  249. Function Turbulence (x, y, size)
  250.     Dim value, initialsize
  251.  
  252.     initialsize = size
  253.     While (size >= 1)
  254.         value = value + SmoothNoise(x / size, y / size) * size
  255.         size = size / 2.0
  256.     Wend
  257.     Turbulence = (128.0 * value / initialsize)
  258.  
  259. '//builds the texture.
  260. Sub buildtexture
  261.     Dim x, y
  262.  
  263.     For x = 0 To nn*twidth - 1
  264.         For y = 0 To theight - 1
  265.             texture(x + y * nn*twidth) = Turbulence(x, y, zoom)
  266.         Next y
  267.     Next x
  268.  
  269. '//draws texture to screen.
  270. Sub drawtexture (dx )
  271.     Dim x, y
  272.         dim as long c, r, g, b
  273.  
  274.     For x = 0 To twidth - 1
  275.         For y = 0 To theight - 1
  276.                         c = pal(texture(((x + dx) + y * nn*twidth)))
  277.                         r = _red(c)
  278.                         g = _green(c)
  279.                         b = _blue(c)
  280.                         c = _rgb(r - 0.2*y, g - 0.2*y, b - 0.2*b)
  281.             PSet (x, y), c'pal(texture(((x + dx) + y * nn*twidth)))
  282.         Next y
  283.     Next x
  284.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #10 on: February 08, 2022, 11:31:13 am »
Hey nice use of that background and timing is good.

Add
Code: QB64: [Select]
 

This wasn't my idea of falling letters, I played that with old QB stuff somewhere recently, I was suggesting different length words.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #11 on: February 08, 2022, 12:31:05 pm »
Oh I see. Well, I'm giving up on these 2 games, I might come back to them later. I might start on something else soon. Thanks anyways.

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #12 on: February 08, 2022, 01:46:12 pm »
Hey @SierraKen, I wouldn't give up on it yet.  I like what you've got started here and thought it was pretty fun.  Got especially challenging as it got faster.

Couple of thoughts for enhancements:

I would recommend adding the following after your Screen _NewImage call on line 13:
_PrintMode _KeepBackground

This will prevent a black block from being drawn behind each letter and give it a nice look.

Also, I would love to see a score or a level being shown as I'm playing so I can see how far I'm progressing (and brag about my high score and lightning fast typing skillz).

Thanks for posting!

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #13 on: February 08, 2022, 02:15:55 pm »
imaginative! I would need a scoring system in the game to know if I was good at it

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 4 Letter Word Invaders Game
« Reply #14 on: February 08, 2022, 02:35:39 pm »
Code: QB64: [Select]
  1. _Title "Quick Falling Letters Game" 'b+ 2022-02-08
  2.  
  3. Dim letters$(1 To 25), lx(1 To 25) As Integer ' screen 0 25 lines 80 letters across
  4. Dim hits, letterPos, i, K$, GameOver
  5.  
  6.     Cls
  7.     letterPos = letterPos + 1 ' generate new letter at each round
  8.     If letterPos > 24 Then GameOver = -1
  9.     For i = letterPos - 1 To 1 Step -1 ' cycle letters and positions down
  10.         letters$(i + 1) = letters$(i)
  11.         lx(i + 1) = lx(i)
  12.     Next
  13.     letters$(1) = Chr$(Int(Rnd * 26) + 97) ' start a new letter
  14.     lx(1) = Int(Rnd * 80) + 1 ' at a new place
  15.     K$ = InKey$ ' check key presses for match to current letterPos
  16.     While K$ = letters$(letterPos) ' catch up with all keypresses
  17.         hits = hits + 1 '            add to score
  18.         letterPos = letterPos - 1
  19.         K$ = InKey$ '                check next keypress
  20.     Wend
  21.     For i = 1 To letterPos 'show board what's left of letters
  22.         Locate i, lx(i): Print letters$(i);
  23.     Next
  24.     Locate 25, 36: Print "Hits:"; hits
  25.     _Limit 1
  26. Loop Until GameOver
  27. Locate 25, 26: Print "Game Over"
  28.  
  29.