Hey everyone,
I'm doing a typing program for the school invention fair. It's supposed to help kids type for grades 2-5. I have a question though.
What i want to do is make it so when a letter when the person is typing is incorrect it makes that letter red. So if the word was "the" but they put "teh" the e and h would be red. How would i go about this.
This is my code:
gosub SetupScreen
gosub SetupSentances
gosub SetupVariables
gosub SetupTyping
gosub loadMedia
do
CLS rgb(0,0,0)
gosub ShowUI
gosub PrintSentance
gosub CheckErrors
gosub CheckTyping
gosub PrintCharacters
sync
loop
ShowUI:
paste image 1,0,0
return
PrintSentance:
ink rgb(100,180,100),0 : if secondGradeSelected=1 then center text screen width()/2,265,SecondGradeCurrent$
return
PrintCharacters:
set cursor 430,427
print ":"+string$
return
CheckErrors:
if returnkey()=1
if string$=secondgradecurrent$ then secondgradeChange=1
if secondgradechange=1 and secondgradecurrent$=secondgrade1$ then secondgradecurrent$=secondgrade2$ : secondgradechange=0
if secondgradechange=1 and secondgradecurrent$=secondgrade2$ then secondgradecurrent$=secondgrade3$ : secondgradechange=0
if secondgradechange=1 and secondgradecurrent$=secondgrade3$ then secondgradecurrent$=secondgrade4$ : secondgradechange=0
if secondgradechange=1 and secondgradecurrent$=secondgrade4$ then secondgradecurrent$=secondgrade5$ : secondgradechange=0
endif
return
CheckTyping:
for t=1 to 86
if inkey$()=c$(t) and flag=0
flag=1
temp$=c$(t)
string$=string$+c$(t)
exit
endif
next t
if flag=1 and inkey$()<>temp$ then flag=0
if (string$<>"" and scancode()=28) or (string$<>"" and scancode()=156)
enterHit=1
string$=""
endif
return
LoadMedia:
load image "media/borders/art1.bmp",1,1
return
SetupSentances:
`2nd Grade Sentances
SecondGrade1$="the cat sat on the mat"
SecondGrade2$="the cow ate the grass"
SecondGrade3$="tom mowed his tall lawn"
SecondGrade4$="he walked to the store"
SecondGrade5$="she sat on her couch"
SecondGrade6$="the box came in the van"
SecondGrade7$="ben watched the movie"
SecondGrade8$="the man put on the hat"
SecondGrade9$="the pen was out of ink"
SecondGrade10$="the pig played in mud"
SecondGradeCurrent$=secondGrade1$
return
SetupScreen:
sync on
sync rate 500
backdrop on
color backdrop rgb(200,200,200)
set text font "trebuchet MS" : set text size 30
set image colorkey 0,0,0
return
SetupVariables:
playerStart=10
BotStart=10
SecondGradeChange=0
string$=""
enterhit=0
dim c$(86)
data "1","2","3","4","5","6","7","8","9","0","-","="
data "q","w","e","r","t","y","u","i","o","p","[","]"
data "\","a","s","d","f","g","h","j","k","l",";","'"
data "z","x","c","v","b","n","m",",",".","/"," ","`"
data "~","!","@","#","$","%","^","&","*","(",")","_"
data "Q","W","E","R","T","Y","U","I","O","P","A","S"
data "D","F","G","H","J","K","L","Z","X","C","V","B"
data "N","M"
`Grade Variables
secondGradeSelected=1
thirdGradeSelected=0
fourthGradeSelected=0
fifthGradeSelected=0
return
SetupTyping:
for t=1 to 86
read z$
c$(t)=z$
next t
return
And media is hooked up below.
Thanks in advanced,
-inverted
Come take a look!