Children's basic typing program

aeixxaeixx My chair

Hello,
I'm trying to create a quick and easy program that will engage young children with learning disabilities. We want them to 'identify, understand, solve.'
The concept is borrowed from the age old typing games of letters falling from top of screen and must not reach bottom. Type the letter to continue the game.

I keep getting 'subscript out of range', and I'm not sure what the reason is.
Please help.

'Rain drop typing game
'
'Type the letters as you see them fall from the top of the screen
'
'Use Escape to exit the program
'
'Use Space to pause
'
'v1.0
'
'************ *************
'************Variables List*************
DimList:
DIM gamerounds AS INTEGER
DIM gamespeed AS INTEGER
DIM difficulty AS INTEGER
DIM L AS INTEGER
'DIM letter$
DIM letter$(27)
DIM W AS INTEGER
DIM screenwidth(60) AS INTEGER
DIM gr AS INTEGER
DIM screenwidth
DIM paws
DIM time

SubList:
declare sub gameinit
declare sub speed
declare sub getcharacters
declare sub design

'************Beginning of Game *************

Begin:

CLS

DO: a$ = INKEY$
CALL gameinit
CALL speed
CALL getcharacters
CALL design

LOOP UNTIL a$ <> CHR$(27)

PRINT "Good bye."

END

SUB gameinit

'************Determine Game Rounds *************

'CLS

INPUT "How many games would you like to play? (1-10)"; gamerounds
IF gamerounds < 1 THEN
PRINT "Lets do at least one game together!"
gamerounds = 1
ELSEIF gamerounds > 10 THEN
PRINT "You may have an addiction to playing computer games, lets play ten games together, then do something else?"
gamerounds = 10
END IF
PRINT "Ok, lets play for "; gamerounds; " rounds."
END SUB

SUB speed

'************Determine Game Speed, Difficulty *************

'cls

INPUT "How fast would you like the game? (1-10)"; gamespeed

IF gamespeed < 1 THEN
PRINT "You seem a little slow, we'll start at your speed."
gamespeed = 1
ELSEIF gamespeed > 10 THEN
PRINT "Prepare to meet your doom!"
gamespeed = 10
ELSE
PRINT "Ok, lets try it at GameSpeed level "; gamespeed; " this time."
END IF

INPUT "What difficulty level would you like? (1-100)"; difficulty

IF difficulty < 1 THEN
PRINT "No newbs allowed, man up, wimp!"
difficulty = 1
ELSEIF difficulty > 10 THEN
PRINT "That's the spirit!"
END IF
PRINT "Difficulty set to: "; difficulty

END SUB

SUB getcharacters

'************Determine Characters Used *************

'CLS

char = 65 'Start of ASCII Alphabet Capitals

L = 1

FOR L = 1 TO 26
letter$(L) = CHR$(char)
PRINT "Letter$("; L; ") = "; CHR$(char) '<--Test&Print what chars used *<<<----PROBLEM
char = char + 1
' IF char = 26 THEN
' char = 26
' END IF
NEXT

END SUB

SUB design
'***************Shows game screen ***************

PRINT "Game start"

'cls

FOR gr = 1 TO gamerounds
FOR time = 1 TO 26
W = INT(RND * 65) + 1
FOR drop = 1 TO 17
LOCATE W, drop
PRINT letter$(L)
FOR paws = 1 TO 1 / gamespeed
IF INKEY$ = letter$(L) THEN
L = INT(RND * 26) + 1
END IF
NEXT
NEXT
NEXT
NEXT

END SUB

Comments

  • typing games are good but main thing of playing is reluxation. these days i am playing online candy crush saga game .

  • forbidden64forbidden64 California, USA

    Well, I am not sure which version of BASIC you are using... on mine the syntax was slightly different. The subscript out of range error was caused by a local variable being used in a subroutine. The statement Dim letters$(27) should be Dim shared letters$(27)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories