Trying to modify letter falling game (Program Bug and Problems)

by Pat, Wednesday, February 13, 2013, 19:52 (1739 days ago) @ M Santos

Thanks !! such an easy solution! Also added mistyped letters to misses, and let user pick speed. Thanks again.. I will keep playing with it, see what can make it even cooler!

# fallinglettergame.kbs

speed = .15 # drop speed - lower to make faster
nletters = 1000 # letters to play

score = 0
misses = 0
color black

fastgraphics

clg
font "Tahoma", 20, 50
text 20, 80, "Falling Letter Game"
input "Enter Speed: 20=Easy 30=Normal 45=Hard 55=Insane! 70=Impossible", speed11
text 20, 140, "Press Any Key to Start"
refresh
# clear keyboard and wait for any key to be pressed
k = key
while key = 0
pause speed
end while

do
letter = int((rand * 26)) + asc("A")
x = 10 + rand * 225
for y = 0 to 250 step speed11
clg
# show letter
font "Tahoma", 20, 50
text x, y, chr(letter)
# show score and points
font "Tahoma", 12, 50
value = (250 - y)
text 10, 270, "Value "+ value
text 100, 270, "Misses "+ misses
text 200, 270, "Score "+ score
refresh
k = key
if k <> 0 then
if k = letter then
score = score + value
else
score = score - value
misses = misses + 1
end if
goto nextletter
end if
pause speed
next y
misses = misses + 1
nextletter:
until misses = 10

clg
font "Tahoma", 20, 50
text 20, 40, "Falling Letter Game"
text 20, 80, "Game Over"
text 20, 120, "Score: " + score
text 20, 160, "Misses: " + misses
refresh
end


Complete thread:

 RSS Feed of thread

powered by my little forum