Author Topic: Simple Keyboard Game  (Read 1213 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 312
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Simple Keyboard Game
« on: October 22, 2021 »
Uses lower case letters.

Emulates one I saw in 1985.

Code: [Select]
letters=20

dim z(letters)

for a=1 to letters
z(a)=int(ran(26))+97
next a

dim x(letters)
dim y(letters)
dim stop(letters)
dim go(letters)
dim re(letters)

for a=1 to letters
stop(a)=int(ran(15))+10
x(a)=int(ran(42))*15+5
y(a)=-15
re(a)=1
next a

man=11

move=15
letters=1
open window 640,512

repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window

g$=inkey$(0)

for a=1 to letters
if g$=chr$(z(a)) score=score+y(a)
if score<1 letters=1
if score>200 letters=2
if score>500 letters=3
if score>1000 letters=4
if score>2000 letters=5
if score>4000 letters=6
if score>10000 letters=7
if score>20000 letters=8
if score>40000 letters=9
if score>50000 letters=10
if score>100000 letters=20
next a

for a=1 to letters
if y(a)>524 and y(a)<540 re(a)=1
re(a)=re(a)+1
if re(a)>5 re(a)=5
if re(a)>2 and re(a)<4 man=man-1
if man<0 man=0
next a

if man=0 move=0
if man=10 move=15
if g$="enter" and man=0 then
for a=1 to letters
y(a)=-15
next a
endif
if g$="enter" and man=0 score=0
if g$="enter" and man=0 man=10

for a=1 to letters
go(a)=go(a)+1
if go(a)>stop(a) go(a)=1
if go(a)>stop(a)-1 y(a)=y(a)+move
next a

for a=1 to letters
if y(a)>540 then
stop(a)=int(ran(15))+30
y(a)=-15
x(a)=int(ran(42))*15+5
z(a)=int(ran(26))+97
endif
next a

for a=1 to letters
if g$=chr$(z(a)) then
x(a)=int(ran(42))*15+5
y(a)=-15
z(a)=int(ran(26))+97
endif
next a

text 250,250,"SCORE:"+str$(score)
text 250,270,"  MEN:"+str$(man)
if man=0 text 250,230,"ENTER to restart"

for a=1 to letters
text x(a),y(a),chr$(z(a))
next a

until (1=0)
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.